我试图编写代码来存储一个变量从post提交到文件的新注释量。我的代码以其当前形式工作,但它总是返回相同的注释。换言之,我可以运行它的时间间隔和较新的评论将不会显示。我试过跟踪this页面和其他各种站点,但找不到任何有关此的信息。你知道吗
非常感谢您的帮助!你知道吗
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
答案很简单:
这不是在原始的PRAW注释文档中,而是在here中找到的。你知道吗
相关问题 更多 >
编程相关推荐