Created
February 21, 2014 05:51
-
-
Save rohitdholakia/9129476 to your computer and use it in GitHub Desktop.
Reading usernames from the Twitter 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
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