top of page
gerstrovaltebit

MTC Pronest 8.02.01 17







A: Probably, your problem is in the csv file itself. It is a DOS-formatted csv file, where each record starts with carriage return and line feed. This is a problem on Linux/Unix, but not on Windows: Line 1: There is a carriage return (13), and a line feed (10). So the first line starts with two characters. Line 2: There is a carriage return (13), a line feed (10) and carriage return (13). So the first two lines start with three characters. Therefore, on each line, there is a mismatch in the number of characters, and you need to adjust the handling accordingly: Python 3: split the line on the carriage return. It returns a list of lines: >>> line = "aladin,30,0,128,3,2015.. Looney Tunes: Back in Action (2013) . Netease. >>> line = line.rstrip(" ") >>> line 'aladin,30,0,128,3,2015.' >>> line.split(" ") ['aladin', '30', '0', '128', '3', '2015.'] You might want to trim the right side of the line, so that you get only one entry per line: >>> line.rstrip(" ").rstrip(" ") 'aladin,30,0,128,3,2015.' You might need to adjust the additional spaces inside the brackets, so that you get only one entry per line: >>> line.replace(" ", " ") 'aladin 30 0 128 3 2015' You might want to add the decimal point: >>> line.replace(" ", " ").replace(",", ".") 'aladin 0.30 0.128 3.2015' You might need to adjust the line feeds inside the brackets: >>> line.replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ac619d1d87


Related links:

14 views0 comments

Comments


bottom of page