I am new to Python 3. Currently, I am working on a project that requires ne to go through a csv file (without using the csv modules) and extract numbers. While I have been able
Strings are immutable in Python, so you will need to always assign row[i]
back to the modified version of itself:
for row in open(filename):
row = row.split(",")
for i in range(len(row) - 1):
row[i] = row[i].replace("\n", "") # CHANGE HERE
row[i] = float(row[i])
lines.append(row)
Note: You don't need to double escape the backslash in \n
when using regular string replace.