0
我试图编写代码来存储变量的数量新的从提交后提交到文件的评论。我的代码以当前的形式工作,但始终返回相同的注释。换句话说,我可以将它运行几小时,新的评论将不会显示。我尝试了以下this页面和其他各种网站,并找不到关于此的任何信息。PRAW:从提交中获取有限数量的新评论
任何帮助非常感谢!
post = reddit.submission(url=link)
fileName = "out/" + platform.lower() + ".txt"
file = open(fileName, 'w+')
for top_level_comment in post.comments:
# Get comment
try:
body = top_level_comment.body
# Parse each line of comment
for line in body.splitlines():
file.write(line + "\n")
except:
continue