Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54869

Re: What's the best way to extract 2 values from a CSV file from each row systematically?

References <fbfc360b-0553-4203-b89a-80b4c4036aec@googlegroups.com> <mailman.276.1379958332.18130.python-list@python.org> <037629ff-64cb-4b35-b61f-54df4d4d4603@googlegroups.com>
From Roland Mueller <roland.em0001@googlemail.com>
Date 2013-09-27 12:22 +0300
Subject Re: What's the best way to extract 2 values from a CSV file from each row systematically?
Newsgroups comp.lang.python
Message-ID <mailman.374.1380275165.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello,

2013/9/24 Alex Lee <quarantinemiles@gmail.com>

> Thanks for the help guys! I'll definitely read up on the csv module
> documentation.
>
> Tim, that's incredibly helpful, thanks a lot! :) My CSV file doesn't have
> headers, but I'm sure I can just as easily add it in manually.
>

a better way to provide column headers is to use the fieldname parameter
when creating the CSV reader. fieldnames is a string array that should
match the number of columns in the csv file:

*class *csv.DictReader(*csvfile*, *fieldnames=None*, *restkey=None*, *
restval=None*, *dialect='excel'*, **args*, ***kwds*)

BR,
Roland

--
> https://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What's the best way to extract 2 values from a CSV file from each row systematically? quarantinemiles@gmail.com - 2013-09-23 10:10 -0700
  Re: What's the best way to extract 2 values from a CSV file from each row systematically? Neil Cerutti <neilc@norwich.edu> - 2013-09-23 17:20 +0000
  Re: What's the best way to extract 2 values from a CSV file from each row systematically? Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-23 13:25 -0400
  Re: What's the best way to extract 2 values from a CSV file from each row systematically? Tim Chase <python.list@tim.thechases.com> - 2013-09-23 12:47 -0500
    Re: What's the best way to extract 2 values from a CSV file from each row systematically? Alex Lee <quarantinemiles@gmail.com> - 2013-09-24 07:04 -0700
      Re: What's the best way to extract 2 values from a CSV file from each row systematically? Roland Mueller <roland.em0001@googlemail.com> - 2013-09-27 12:22 +0300
  Re: What's the best way to extract 2 values from a CSV file from each row systematically? Luca Cerone <luca.cerone@gmail.com> - 2013-09-28 03:21 -0700

csiph-web