Skip to content

Instantly share code, notes, and snippets.

@rohitdholakia
Created December 27, 2011 21:24
Show Gist options
  • Select an option

  • Save rohitdholakia/1525207 to your computer and use it in GitHub Desktop.

Select an option

Save rohitdholakia/1525207 to your computer and use it in GitHub Desktop.
Python script to write all tweets into a single file
#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