[Tutor] File IO Help again

bob bgailer at alum.rpi.edu
Fri Oct 28 06:30:50 CEST 2005


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' 



More information about the Tutor mailing list