Trying Improve Code Written Python 3 Codio Currently Outputs Name First Column Every Data Q37133127

I am trying to improve a code written in python 3 codio.

It currently outputs the name in the first column for every datatype.

The data is an excel file. The first two rows look likethis:

Name Gender

Abbie Hart female

There are more columns of data beyond this. The code looks likethis:

import csv

import re rownum = 0

column = 0 with open(‘customerData.csv’) as

csvfile: reader = csv.reader(csvfile)

for row in reader:

if rownum == 0:

header = row

else: column = 0

print (“nnRow Number: %i” %rownum)

for col in row:

print (“%-8s: %s” % (header[column], col))

column += 1

rownum += 1

The output looks like this

Row Number: 0

Austin Jackson: Austin Jackson

Austin Jackson: male

I want

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.