open('ch /ex csv'reader csv reader(fiterating through the reader like file yields tuples of values in each like with any quote characters removedin [ ]for line in readerprint line [' '' '' '[' '' '' '[' '' '' '' 'from thereit' up to you to do the wrangling necessary to put the data in the form that you need it for examplein [ ]lines list(csv reader(open('ch /ex csv'))in [ ]headervalues lines[ ]lines[ :in [ ]data_dict {hv for hv in zip(headerzip(*values))in [ ]data_dict out[ ]{' '(' '' ')' '(' '' ')' '(' '' ')csv files come in many different flavors defining new format with different delimiterstring quoting conventionor line terminator is done by defining simple subclass of csv dialectclass my_dialect(csv dialect)lineterminator '\ndelimiter ';quotechar '"reader csv reader(fdialect=my_dialectindividual csv dialect parameters can also be given as keywords to csv reader without having to define subclassreader csv reader(fdelimiter='|'the possible options (attributes of csv dialectand what they do can be found in table - table - csv dialect options argument description delimiter one-character string to separate fields defaults to ',lineterminator line terminator for writingdefaults to '\ \nreader ignores this and recognizes cross-platform line terminators quotechar quote character for fields with special characters (like delimiterdefault is '"quoting quoting convention options include csv quote_all (quote all fields)csv quote_minimal (only fields with special characters like the delimiter) data loadingstorageand file formats www it-ebooks info