csvfile loader using csv module

Solutions on MaxInterview for csvfile loader using csv module by the best coders in the world

showing results for - "csvfile loader using csv module"
Leon
24 Aug 2016
1# Sourece from RealPython.com
2# source link : https://realpython.com/python-csv/
3
4import csv
5
6with open('employee_birthday.txt') as csv_file:
7    csv_reader = csv.reader(csv_file, delimiter=',')
8    line_count = 0
9    for row in csv_reader:
10        if line_count == 0:
11            print(f'Column names are {", ".join(row)}')
12            line_count += 1
13        else:
14            print(f'\t{row[0]} works in the {row[1]} department, and was born in {row[2]}.')
15            line_count += 1
16    print(f'Processed {line_count} lines.')
17    
18  
19
similar questions
queries leading to this page
csvfile loader using csv module