[Tutor] Re: .....str.count and str.split/solved

Tim Johnson tim at johnsons-web.com
Fri May 7 22:01:34 EDT 2004


* Danny Yoo <dyoo at hkn.eecs.berkeley.edu> [040507 15:50]:
> 
> 
> On Fri, 7 May 2004, Tim Johnson wrote:
> 
<....> 
> 
> 
> Ah!  You probably don't need to do anything too special.  If you open the
> file in "universal newline" mode, then Python will automagically handle
> platform-specific newline stuff.  See:
> 
>     http://www.python.org/doc/lib/built-in-funcs.html#l2h-25
> 
> Look at the 'U' mode for universal newlines --- I think it should do what
> you want.
 
  I'm currently using ver 2.2 on RH 9.0 --- mode 'rU' is recognized.
  I commented out the code that removes '\r'
     line.rstrip('\r') 
  '\r' remained in the line, 

  Using "U" throws IOError

  I'll read through those doc some more.
  thanks
  tim

-- 
Tim Johnson <tim at johnsons-web.com>
      http://www.alaska-internet-solutions.com



More information about the Tutor mailing list