def main(argv): out = sys.stdout global users for file in argv: twittercollect.parse(file,print_features) for k in users.keys(): sender = k followers = users[k][1] print >> out, sender, followers
def main(argv): fieldsFile = open(argv[0]).readlines() fieldsString = fieldsFile[0].split(' ') for word in fieldsString: if word.strip(): fields.append(word.strip()) for filename in argv: if filename.find('.json')!=-1: tc.parse(filename, tweet_printer)
def main(argv, stdout=None, stderr=None): stdout = stdout or sys.stdout stderr = stderr or sys.stderr def tweet_printer(tweet): if is_at_message(tweet): id = tweet["id"] fr = tweet["user"]["id"] dt = datetime.datetime.strptime(tweet["created_at"], "%a %b %d %H:%M:%S +0000 %Y").strftime("%s") print >> stdout, id, fr, dt for filename in argv: twittercollect.parse(filename, tweet_printer)
def main(argv, stdout=None, stderr=None): stdout = stdout or sys.stdout stderr = stderr or sys.stderr def tweet_printer(tweet): if is_at_message(tweet): id = tweet['id'] fr = tweet['user']['id'] to = tweet['in_reply_to_user_id'] dt = datetime.datetime.strptime(tweet['created_at'], '%a %b %d %H:%M:%S +0000 %Y').strftime('%s') print >> stdout, id, fr, to, dt for filename in argv: twittercollect.parse(filename, tweet_printer)
def main(argv): for file in argv: twittercollect.parse(file,print_features)