當我嘗試從python中的csv文件讀取時,我總是收到「無效關鍵字」錯誤。任何想法爲此工作?訪問python中的csv文件
C:\Python27\python.exe C:/Users/User_Name/PycharmProjects/untitled/car.py
Traceback (most recent call last): File
"C:/Users/User_Name/PycharmProjects/untitled/car.py", line 122, in <module> d = handle_refugee_data.DataTable(csvformat="generic", data_directory="car2014", start_date="2013-12-01") File
"C:\Users\User_Name\PycharmProjects\untitled\handle_refugee_data.py", line 78, in __init__ with open("%s/%s" % (data_directory, data_layout), newline='') as csvfile:
TypeError: 'newline' is an invalid keyword argument for this function
Process finished with exit code 1
========================================================================
你能發佈你的代碼嗎? – bhazero025
它看起來像'open()'沒有這樣的關鍵字:https://docs.python.org/2/library/functions.html#open但是,只有在你發佈你的代碼後, 。 – wanderlust
就此而言:[csv](https://docs.python.org/2/library/csv.html)位於標準庫中。 – dhke