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