Created
December 27, 2011 21:24
-
-
Save rohitdholakia/1525207 to your computer and use it in GitHub Desktop.
Python script to write all tweets into a single file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #This is to take only tweets from a file and put them in another file | |
| import sys | |
| tweetsFile=open(sys.argv[1],'r')#Having the tweets | |
| newFile=open(sys.argv[2],'w')#With only tweets, no user and time data | |
| import itertools | |
| for line1,line2,line3 in itertools.izip_longest(*[tweetsFile]*3): | |
| line3=line3.split('\t') #Split on the basis of tab as we only need the right side , the tweet | |
| newFile.write(line3[1]+"\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment