Hello all, I wrote and saved a program using tweepy to stream the twitter api,I used csv file in saving but cant find the location anywhere on my computer. Below is the code.
.
The program does not indicate any error but is not splitting the tweets as expected, secondly I cant find the location of TwitDB2.Am using python 3.6.
Thanks in advanced
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
class Listener(StreamListener): def on_data( self ,data): try : print (data) #cleaning up tweets to get only the time and text tweet = data.split( ',"text":"' )[ 1 ].split( '","source' )[ 0 ] print (tweet) saveThis = str (time.time()) + "::" + tweet #saving stream data to csv file saveFile = open ( 'twitDB2.csv' , 'a' ) saveFile.write(saveThis) saveFile.write( '\n' ) saveFile.close() return ( True ) except BaseException as e: print ( 'failed ondata,' , str (e)) time.sleep( 5 ) |
The program does not indicate any error but is not splitting the tweets as expected, secondly I cant find the location of TwitDB2.Am using python 3.6.
Thanks in advanced