On Aug 15, 3:33 am, Suresh Babu Kolla <[EMAIL PROTECTED]> wrote:
> Paul Carter wrote:
>
> > The problem is with how you are opening the file. You need to open in
> > binary mode if you wish to read your file unaltered. Also, file() is
> > preferred over open() these days I think. Use:
>
> > dfile = file('test.csv', 'rb')
>
>  From Python 2.5 library documentation.
>
> <quote>
>       When opening a file, it's preferable to use `open()' instead of
>       invoking this constructor directly.  `file' is more suited to type
>       testing (for example, writing `isinstance(f, file)').
> </quote>
>
> Python documentation seem to recommend using open(). I personally prefer
> to use open, just because python open has same signature as POSIX open,
> even beginner programmers can understand the intent of the code clearly.
>
> Kolla

Yeah, you're right. I know I had read that file() was preferred
somewhere, but obviously it wasn't a good source. Thanks for the
correction!

--
Paul

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to