問題
讀出來的CSV文件有空的列表
原因
寫入csv文件時有問題
有問題的寫入代碼:
with open('sd.csv', 'w+', ') as f:
a = csv.writer(f)
a.writerows(info)
正確的寫入代碼:
with open('sd.csv', 'w+', newline='') as f:
a = csv.writer(f)
a.writerows(info)
讀出來的CSV文件有空的列表
寫入csv文件時有問題
有問題的寫入代碼:
with open('sd.csv', 'w+', ') as f:
a = csv.writer(f)
a.writerows(info)
正確的寫入代碼:
with open('sd.csv', 'w+', newline='') as f:
a = csv.writer(f)
a.writerows(info)
jupyter的原始打開路徑是C盤的用戶,如果想在其他路徑打開,將路徑複製成文本,打開cmd,輸入 jupyter notebook + 路徑,回車就行