Oct-05-2020, 08:46 AM
There is some low level stuff you can let csv module to handle. For example, if there is a file with one row: "AAPL", 113.02 then we can leave handling of "" and conversion to csv module:
import csv with open('aapl.csv', 'r') as f: reader = csv.reader(f, quoting=csv.QUOTE_NONNUMERIC) print(*reader) # -> ['AAPL', 113.02] with open('aapl.csv', 'r') as f: data = [item for row in f for item in row.strip().split(', ')] print(data) # -> ['"AAPL"', '113.02']
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.