with open(FILENAME, 'a', encoding='utf-8') as f:
n = 0
for tweet in rs.stream():
n += 1
if n % PRINT_AFTER_X == 0:
print('{0}: {1}'.format(str(n), tweet['created_at']))
json.dump(tweet, f)
f.write('\n')
print('done')
How can I convert “tweet[‘created_at’]” twitter date-time format to " Unix epoch time" ot “MM/dd/yyyy H:mm” format in my code block before save to json file .
The dates are already UTC, like all dates on Twitter API. The format is:
'%a %b %d %H:%M:%S +0000 %Y'
This might help: https://stackoverflow.com/a/7711869/11090908
1 Like
Thanks Igor. but I couldnt solve in python . But I ve converted in excel after downloaded tweets
system
closed
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.