Quantcast
Channel: User bavaza - Stack Overflow
Viewing all articles
Browse latest Browse all 45

Answer by bavaza for How to get csv rows as array with Python csv?

$
0
0

Short answer:

with open('zumatchende.csv') as f:    cf = csv.reader(f)    row = [e[0] for e in cf]        rowOut[14]: ['a', 'b', 'c', 'd']

Long answer:

Per the docs, DictReader outputs a dictionary whose keys are given by the optional fieldnames parameter. If fieldnames is omitted, the values in the first row of file f will be used as the fieldnames.

See a similar question here.


Viewing all articles
Browse latest Browse all 45

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>