I am a beginner in python. I need help with the following
I have a comma separated csv file, eg
for row in reader:
You don't need the csv module to do that. Just call the
read method of the file object to read in all the lines as one string:
with open(filename) as f: s = f.read() + '\n' # add trailing new line character print(repr(s)) # 'a,b,c\nd,e,f\ng,h,i\n'
I'm printing the
repr of the string because a print of the string itself i.e.
print(a) will not show the newline character as
\n, but will show the string in its different lines.