0

while reading the CSV file in these lines :

csv_file = open(sys.argv[1], "r")  # reading the csv file into memoery
csv_reader = csv.DictReader(csv_file)

when i tried to make a copy of the csv_reader while using the for loop it worked, but any changes to that copy version affected the csv_reader variable, plus

for line in csv_reader:
    copy = line 
    break

for line in csv_reader:
    print(line)

the second for loop will print everything except for the first line in thencsv_file , why?

I would really be thankful if you gave me the answer thanks in advance !!

You must log in to answer this question.

Browse other questions tagged .