Line indexing in Python

Lie Ryan lie.1296 at gmail.com
Tue Dec 22 12:42:28 EST 2009


On 12/22/2009 11:25 PM, Steve Holden wrote:
>> >
>> >  If you want to extract an index number from the first part of of a given
>> >  line use split( split_character, maximum_splits_to_do ) and then angle
>> >  brackets to reference the first part (index 0)...
>> >
>> >
>>>>> >>>>  a = "20 GOTO 10"
>>>>> >>>>  int( a.split(' ',1)[0] )
>> >  20
>> >
> <nit>
> those are brackets, not angle brackets
> </nit>
>

<double_nit>
those [] are square brackets, not angle brackets
</double_nit>



More information about the Python-list mailing list