python - prevent DictReader from adding quotes -


i want convert csv python dict. keys strings values not.

 vertical;"aaa";"bbb";"ccc"  "one";1;none;3  two";11;22;{"t":"type","v":"value"}  three";111;222;333 

whatever use quoting , quotechar, dictreader adds quotes.

reader = csv.dictreader(open('matrix_test.csv'), delimiter=";") row in reader:     component_type = row["vertical"]     row.pop("vertical")     matrix.update({component_type: row}) 

this get:

{'"one"': {'"aaa"': '1', '"bbb"': 'none', '"ccc"': '3'},  '"three"': {'"aaa"': '111', '"bbb"': '222', '"ccc"': '333'},  '"two"': {'"aaa"': '11', '"bbb"': '22', '"ccc"': '{"t":"type","v":"value"}'}} 

but don't want quotes around numbers, dicts, , none. want them there put them in csv.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -