getting values from a text file (newby)

John Machin sjmachin at lexicon.net
Sun Feb 1 22:52:04 EST 2009


On Feb 2, 10:18 am, vsoler <vicente.so... at gmail.com> wrote:
> On 1 feb, 23:57, John Machin <sjmac... at lexicon.net> wrote:
>
> > On Feb 2, 6:18 am, vsoler <vicente.so... at gmail.com> wrote:
>
> > > r: in the open statement, why do you use 'rb' as 2nd argument? b is
> > > supposed to be binary, and my file is text!
>
> > Because unlike Stephen, r has read the csv manual. Binary mode is
> > required to handle properly cases like '\n' embedded in a field --
> > something which can easily happen when the data has been extracted
> > from a database with slack data-entry validation.
>
> Where can I get the csv manual?

http://www.python.org/doc/2.6/library/csv.html

If you're on Windows, you've got it already:
Start > All Programs > Python 2.6 > Python Manuals
type "csv" (without the quotes) into the textbox
hit the Enter key




More information about the Python-list mailing list