Exercise: Read CSV File (csv.dictreader)

Requirement

As a followup to Exercise: Read CSV File (csv.reader), use the following table (download CSV) to read the user records from.

Users-header-cp1252.csv

ID

First name

Last name

Date of Birth

1

Jörg;DI

Faschingbauer

19.6.1966

2

Caro

Faschingbauer

25.4.1997

3

Johanna

Faschingbauer

11.6.1995

4

Philipp

Lichtenberger

6.4.1986

5

Elizabeth II

Queen

1.1.1900

Write a program read-userdb-header.py that reads that file row by row (use Python’s csv.dictreader), and outputs the user records like follows.

$ python read-userdb-header.py Users-header-cp1252.csv
ID:1, Firstname:Jörg;DI, Lastname:Faschingbauer, Date of birth: 19.6.1966
ID:2, Firstname:Caro, Lastname:Faschingbauer, Date of birth: 25.4.1997
ID:3, Firstname:Johanna, Lastname:Faschingbauer, Date of birth: 11.6.1995
ID:4, Firstname:Philipp, Lastname:Lichtenberger, Date of birth: 6.4.1986
ID:5, Firstname:Elizabeth II, Lastname:Queen, Date of birth: 1.1.1900

Note

Btw, like in Exercise: Read CSV File (csv.reader), the CSV file is encoded in cp1252.

Dependencies

cluster_python Python Programming: From Absolute Beginner to Advanced Productivity cluster_python_basics Python: The Language Fundamentals cluster_python_exercises Exercises cluster_python_exercises_userdb User Database (Exercise Series) cluster_python_misc Python: Miscellaneous Topics python_basics_python_0300_strings More About Strings python_basics_python_0150_datatypes_overview Datatypes python_basics_python_0300_strings->python_basics_python_0150_datatypes_overview python_basics_python_0200_sequential_types Sequential Datatypes python_basics_python_0300_strings->python_basics_python_0200_sequential_types python_basics_python_0250_refs_flat_deep_copy References, (Im)mutability python_basics_python_0300_strings->python_basics_python_0250_refs_flat_deep_copy python_basics_python_0130_syntax_etc Syntax etc. python_basics_python_0120_helloworld Hello World python_basics_python_0130_syntax_etc->python_basics_python_0120_helloworld python_basics_python_0110_blahblah Blahblah python_basics_python_0120_helloworld->python_basics_python_0110_blahblah python_basics_python_0220_for for Loops python_basics_python_0193_while while Loops python_basics_python_0220_for->python_basics_python_0193_while python_basics_python_0220_for->python_basics_python_0200_sequential_types python_basics_python_0139_commandline_argv Commandline Arguments (sys.argv) python_basics_python_0139_commandline_argv->python_basics_python_0130_syntax_etc python_basics_python_0125_running Running Python Programs python_basics_python_0139_commandline_argv->python_basics_python_0125_running python_basics_python_0140_variables Variables python_basics_python_0140_variables->python_basics_python_0130_syntax_etc python_basics_python_0150_datatypes_overview_compound Compound Datatypes python_basics_python_0150_datatypes_overview_compound->python_basics_python_0150_datatypes_overview python_basics_python_0160_boolean Boolean python_basics_python_0160_boolean->python_basics_python_0150_datatypes_overview python_basics_python_0193_while->python_basics_python_0160_boolean python_basics_python_0170_if The if Statement python_basics_python_0193_while->python_basics_python_0170_if python_basics_python_0170_if->python_basics_python_0160_boolean python_basics_python_0150_datatypes_overview->python_basics_python_0140_variables python_basics_python_0125_running->python_basics_python_0120_helloworld python_basics_python_0200_sequential_types->python_basics_python_0150_datatypes_overview_compound python_basics_python_0330_strings_encoding Strings and Encoding python_basics_python_0330_strings_encoding->python_basics_python_0300_strings python_basics_python_0250_refs_flat_deep_copy->python_basics_python_0140_variables python_basics_python_0250_refs_flat_deep_copy->python_basics_python_0150_datatypes_overview_compound python_basics_python_0250_refs_flat_deep_copy->python_basics_python_0150_datatypes_overview python_basics_python_0500_files File I/O python_basics_python_0500_files->python_basics_python_0220_for python_basics_python_0500_files->python_basics_python_0330_strings_encoding python_exercises_userdb_csvdictreader Exercise: Read CSV File (csv.dictreader) python_exercises_userdb_csvdictreader->python_basics_python_0139_commandline_argv python_exercises_userdb_csvreader Exercise: Read CSV File (csv.reader) python_exercises_userdb_csvdictreader->python_exercises_userdb_csvreader python_misc_csv CSV Files python_exercises_userdb_csvdictreader->python_misc_csv python_exercises_userdb_csvreader->python_basics_python_0139_commandline_argv python_exercises_userdb_csvreader->python_misc_csv python_misc_csv->python_basics_python_0220_for python_misc_csv->python_basics_python_0150_datatypes_overview_compound python_misc_csv->python_basics_python_0500_files