1

When printing the rows of my csv file, the first row of data is missing

this is the code I have so far

import csv

with open('Data/inputdata_c950.csv', encoding='utf-8-sig') as csvfile:
    input_data = csv.reader(csvfile, delimiter=',')

    for row in input_data:
        package_id = row[0]
        address = row[1]
        city = row[2]
        state = row[3]
        zip_code = [4]
        delivery = row[5]
        size = row[6]
        note = [7]
        start_time = ''
        address_location = ''
        delivery_status = 'At Hub'
        
        for row in input_data:
            print(row[0])

I don't see the first row, which should be 1. my output is

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Burhan Ali
  • 2,258
  • 1
  • 28
  • 38
Ainz71
  • 11
  • 2
  • 3
    The first `for row in input_data:` has already *taken/used* the first row. Delete the second `for row in input_data:` and de-dent the print. – wwii Mar 11 '23 at 05:14

0 Answers0