Skip to content

Instantly share code, notes, and snippets.

@rohitdholakia
Created February 21, 2014 05:51
Show Gist options
  • Save rohitdholakia/9129476 to your computer and use it in GitHub Desktop.
Save rohitdholakia/9129476 to your computer and use it in GitHub Desktop.
Reading usernames from the Twitter file
import sys
import os
with os.popen('zcat ' + sys.argv[1]) as tweet_file, open(sys.argv[2], 'w') as output:
#skip all lines with anything but U in them
for line in tweet_file:
parts = line.rstrip().split('\t')
if 'U' not in parts[0]:
continue
output.write(parts[1].lstrip('http://twitter.com/') + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment