みんな!Web サイトからデータをスクレイピングし、まだコピーされていないエントリを .csv ファイルに追加しようとしていますが、適切に書き込むことができないようです。
url = 'www.website.com'
def getInfo():
global oldMaxValue, oldMaxRow, newInfo
newInfo = 0
with open("file.csv", "a") as f:
data = requests.get(url)
text = data.text
newRows = [line.split(',') for line in text.split("\n") if line]
newMaxValue = max(row[0] for row in newRows)
for i in newRows:
if int(i[0]) > int(oldMaxValue):
f.write(str(i))
oldMaxValue = newMaxValue
ガイダンスをいただければ幸いです。どうもありがとう!:)