My script prints top 5 subreddits from specified redditor.
reddit = praw.Reddit(
client_id="",
client_secret="",
password="",
user_agent="",
username="",
)
for submission in reddit.redditor("").top(limit=5):
print(submission.subreddit)
Im trying to store in txt file what is being printed.
I was trying to use this method:
f = open('file.txt', 'w+')
f.write(submission.subreddit)
f.close()
But received this error at the end
TypeError: write() argument must be str, not Subreddit
Any ideas how can I store subreddits in txt file?