I'm importing a simple CSV file. I want to print its content line-by-line and then print it once again, but now as a list of lists representing each line. The following code:
fo = open('filename.csv', 'r')
content = csv.reader(fo)
for each in content:
print(each)
print("Content as a list: ", list(content))
fo.close()
works as expected for the first task, but then prints an empty list after 'Content as a list'. If I comment the for loop out, I get the desired result, though. Why does the for loop affect the list(content)
below?