Skip to content

Instantly share code, notes, and snippets.

@iontom
Created August 11, 2017 20:58
Show Gist options
  • Save iontom/be4fdd4bba17a9ba7d5db933b130a131 to your computer and use it in GitHub Desktop.
Save iontom/be4fdd4bba17a9ba7d5db933b130a131 to your computer and use it in GitHub Desktop.
for year in range(2021, 2038):
for submission in reddit.subreddit('futurology').search(str(year), sort='relevance'):
print(submission.title)
print 'https://www.reddit.com'+submission.permalink
# Append to the file here
filename = "DATA/prediction.txt"
# Append the comments
with io.open(filename, 'a', encoding='utf-8') as file:
file.write(submission.title)
for comment in submission.comments:
file.write(comment.body)
print(comment.body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment