Error encountered: _csv. Error:new-line character seen in unquoted field-do do need to open the file in Universal-newline mode?
The error code is as follows:
1 ImportCSV2 ImportSYS3 4Input_file = sys.argv[1]5Output_file = sys.argv[2]6 7With open (Input_file,'R') as Csv_in_file:8With open (Output_file,'W') as Csv_out_file:9FileReader =Csv.reader (csv_in_file)TenFileWriter =Csv.writer (csv_out_file) OneHeader =Next (FileReader) A - #Print Header - the Filewriter.writerow (header) - forRow_listinchFileReader: -#Printrow_list -Supplier =str (row_list[0]). Strip () +Cost = str (row_list[3]). Strip ("$"). Replace (',',"') - ifSupplier = ='Supplier X' orFloat (cost) >600.0: +Filewriter.writerow (Row_list)
Workaround:
The above code line 7th is written with open (Input_file, ' RU ') as Csv_in_file: Post-resolution
The main mode of opening the file is incorrect.
' U ' universal newline mode (deprecated)--deprecated in Python3
See: http://www.runoob.com/python/python-func-open.html
78808779
Debug CSV File Open error