【发布时间】:2022-01-15 20:07:48
【问题描述】:
我收到一个错误 ValueError: I/O operation on closed file。使用以下代码时,我的其余代码似乎工作正常,有什么想法吗?
tweets_file = open(tweets_data_path, 'r')
for line in tweets_file:
tweet = json.loads(line)
tweets_data.append(tweet)
ValueError Traceback (most recent call last)
<ipython-input-44-722708c7e759> in <module>()
1 # Read in tweets and store in list: tweets_data
----> 2 for line in tweets_file:
3 tweet = json.loads(line)
4 tweets_data.append(tweet)
ValueError: I/O operation on closed file.
【问题讨论】:
标签: python tweepy jsondecoder