Last active
January 5, 2019 08:17
-
-
Save eritbh/eaada5ac9ef9c5a3b681b105b3ace9fc to your computer and use it in GitHub Desktop.
Move moderator applications from a CSV generated from a Google Forms response sheet to individual comments on a submission.
This file contains 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 csv | |
import praw | |
import re | |
r = praw.Reddit(client_id="",client_secret="",username="",password="",user_agent="") | |
submission = r.submission(id="") | |
with open("file.csv", "r", encoding="utf-8") as file: | |
apps_reader = csv.reader(file) | |
for i, row in enumerate(apps_reader): | |
if i == 0: | |
headings = row | |
continue | |
text = "" | |
for j, col in enumerate(row): | |
content = " " + re.sub("\n", "\n ", col) | |
text += f"# {headings[j]}\n\n{content}\n\n" | |
print(text) | |
submission.reply(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment