【发布时间】:2018-09-15 02:25:22
【问题描述】:
import codecs
with open(filename+'.txt', 'a+', encoding='utf-8') as f:
for tweet in list_of_tweets:
print(tweet.text.replace('\r','').replace('\n','')+'|')
f.write(tweet.text.replace('\r','').replace('\n','')+'|')
它的显示
TypeError Traceback(最近调用 最后)在() 1 导入编解码器 ----> 2 with open(filename+'.txt', 'a+', encoding='utf-8') as f: 3 用于 list_of_tweets 中的推文: 4 print(tweet.text.replace('\r','').replace('\n','')+'|') 5 f.write(tweet.text.replace('\r','').replace('\n','')+'|')
TypeError: 'encoding' 是该函数的无效关键字参数
【问题讨论】:
标签: python