Re: [Tutor] File IO Help again

2005-10-28 Thread Liam Clarke
Heh, Cut 'im some slack there Bob, I only just figured out that line[:1] == line[0]... On 10/28/05, bob <[EMAIL PROTECTED]> wrote: > At 01:42 PM 10/27/2005, Adam wrote: > > >if line[:1] == "1": > > > >This line won't work because you're getting the first 2 characters from > >the line > > Oh? Did

Re: [Tutor] File IO Help again

2005-10-27 Thread bob
At 01:42 PM 10/27/2005, Adam wrote: > >if line[:1] == "1": > >This line won't work because you're getting the first 2 characters from >the line Oh? Did you test that? When I do that I get 1 character. Why? Because slicing goes UP TO the 2nd argument. >>> 'abc'[:1] 'a'

Re: [Tutor] File IO Help again

2005-10-27 Thread Adam
>if line[:1] == "1": This line won't work because you're getting the first 2 characters from the line and seeing if it's equal to a string of length one. For example in your test file if you put this line, 1      12.4    12.0    *   10 , through that bit of code it would see if "1 " == "1", which

Re: [Tutor] File IO Help again

2005-10-27 Thread bob
At 12:18 PM 10/27/2005, Mike Haft wrote: >Apologies for not making things clearer last time. > >My specific problems are: > >why can I not get the readline() or readlines() functions to work, I'm >told they are not defined whenever I try. Mike * Oh * Mike ... and all others ... Please Post The Co

Re: [Tutor] File IO Help again

2005-10-27 Thread Danny Yoo
On Thu, 27 Oct 2005, Mike Haft wrote: > why can I not get the readline() or readlines() functions to work, I'm > told they are not defined whenever I try. Don't paraphrase. *grin* Show us what you did in terms of the code that you ran. Also, include the literal error message and its tracebac

[Tutor] File IO Help again

2005-10-27 Thread Mike Haft
Apologies for not making things clearer last time. My specific problems are: why can I not get the readline() or readlines() functions to work, I'm told they are not defined whenever I try. Also the following: if line[:1] == "1": collects data from month 1, 10, 11, and 12. How do I make the re