[英]Writing tweets to a JSON file using tweepy automatically adds a blank line on my PC and makes the file unreadable in Python
[英]Using Pandas and Tweepy do I need to read a json file of tweets line by line
我有以下代碼將推文保存到json文件
for tweets in tweepy.Cursor(api.user_timeline, id=account).items(1000):
# depending on where the supports club are home or away
if tweets.created_at >= EarliestTweet:
#Write it to a file
json.dump(tweets._json,jsonfile, sort_keys = True, skipkeys = True, indent = 2,ensure_ascii=False)
使用pandas dataframe.read_json
是否需要逐行讀取json文件,還是可以通過read_json文件名來創建數據框
pandas.read_json
應該返回一個數據幀。 在此處閱讀文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.