Combine items in two list to form dictionary(map)

by , under python

People love python because it has solutions built in for problems most frequently faced by developers. Python’s zip is one such thing.


You would most probably need this in scenarios like csv file reading where the first row in the file is list of column names and subsequent are values. You know well that it is better to use map to read/write the values in a row like row[colName] = x or x = row[colName] rather than index like row[1] etc.,

Note: In case of csv file reading/writing, python does have a out-of-the-box solution: DictReader and so you don’t even have to do” even” this one liner 🙂 above…

Leave a Reply