I am trying to print the customer data in one list and thesensitive data in another list via python 3. Currently the code isprinting all of the data and appending the items to the end. Thedata is in a csv file in excel.
import csv
import re
customerdata = []
sensitivedata = [] with open(‘customerData.csv’) as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
customerdata.append(row)
print(customerdata[0])
print(customerdata[1][“Name”])
print(customerdata[2][“Email”])
print(customerdata[3][“Phone”])
with open(‘customerData.csv’) as csvfile:
reader = csv.DictReader(csvfile)
for row in reader: sensitivedata.append(row)
print(sensitivedata[0])
print(sensitivedata[1][“SSN”])
print(sensitivedata[2][“Credit Card”])
print(sensitivedata[3][“Credit Card_Number”])
Looking to out put this in two lists
list 1
Name : joe Boo
eMail: joeboo@yahoo.com
phone: 987-654-3210
list 2
ssn: ***-**-6789
Card: Visa
credit card #: 4264-****-****-1234
Answer