我正在尝试将包含推文的列表保存到csv文件中。这是我的代码:
def get_all_tweets(screen_name):
all_tweets=[]
for page in Cursor(api.user_timeline, screen_name=screen_name,count=5).pages(1):
for status in page:
outtweets = ([screen_name, status.created_at, status.text.encode('utf-8'),status.user.location, status.lang]) #for tweet in status]
all_tweets.extend(outtweets)
with open('tweets1_DB_SS.csv','w',encoding='utf-8') as f:
writer = csv.writer(f)
writer.writerows(all_tweets)
我收到以下错误:
---> 12 writer.writerows(all_tweets)
Error: iterable expected, not datetime.datetime
知道怎么解决吗?