我正在写一个csv文件。它在控制台中正确显示,但是当我打开csv文件时,它没有正确显示Href。
其余工作正常,这是唯一的问题。 代码:
elems = driver.current_url
for elem in elems:
print(elems)
print(("NEW LINE BREAK"))
import sys
import io
with open('vtg121.csv', 'a', newline='', encoding="utf-8") as outfile:
writer = csv.writer(outfile)
for row in zip(langs_text, langs1_text, langs2_text, langs3_text, elems):
print(row)
writer.writerow(row)
答案 0 :(得分:1)
你最有可能想要每一行都有网址?如果是,那么你需要这样做
url = driver.current_url
print(("NEW LINE BREAK"))
import sys
import io
with open('vtg121.csv', 'a', newline='', encoding="utf-8") as outfile:
writer = csv.writer(outfile)
for row in zip(langs_text, langs1_text, langs2_text, langs3_text):
print(row)
writer.writerow(row + (url,))