简体   繁体   中英

extracting data from fetched tweets

I fetched some tweets with tweepy api and saved them in a txt file. Now I want to extract them into data frame with panda, like, the content of the tweet and maybe the date. Any ideas how I can do it? Btw. I'm really new in python.

Thanks in advance

Depending on the format of your txt file,your approach may vary but overall: You want to open the file in python, read it (probably line by line), and parse it into a panda dataframe.

for example to extract a line of your document:

file = open(“testfile.txt”, “r”) 
for line in file: 
   # do something (like parsing) on your line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM