Skip to content

Instantly share code, notes, and snippets.

@edsu edsu/
Last active Apr 25, 2019

What would you like to do?
#!/usr/bin/env python3
import re
import csv
import json
import twarc
import string
import collections
jobs = collections.Counter()
twitter = twarc.Twarc()
for tweet in'5jobsivehad'):
if 'retweeted_status' in tweet:
text = tweet['full_text']
for line in text.split('\n'):
m = re.match(r'^[1-5][' + string.punctuation + ']? (.+)', line)
if m:
job =
if not"jobs had", job):
jobs[job] += 1
output = csv.writer(open('jobs.csv', 'w'))
output.writerow(['job', 'count'])
for job, count in jobs.most_common():
output.writerow([job, count])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.