On Thu, Jul 18, 2013 at 3:19 PM, <[email protected]> wrote:
> caldata = open('mlccal.dat','r').read().**split('\n')
>
> Another idiom here was to use the interpreter to try out the various
> expressions interactively -- for example to remind myself to use
> split('\n')
> to break on lines, not the default split() which breaks on spaces.
>
I hate to be a nudge, but I'd use:
caldata = open('mlccal.dat','r').readlines()
>
oh, and 'U' mode, in case you get a DOS or even old-mac style text file...
('r' is default, but better explicit than implicit...)
caldata = open('mlccal.dat','rU').readlines()
So another "idiom": code review!
-Chris
--
Christopher Barker, PhD
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython