[Tutor] string.split() into a list
Randy Bush
randy at psg.com
Wed Oct 19 01:30:05 CEST 2005
>> >>> s='1|2|3|4'
>> >>> l=s.split('|')
>> >>> a, l = l[0], l[1:]
>> >>> a
>> '1'
>> >>> l
>> ['2', '3', '4']
i went with the above, or more specifically
aList = line[:-1].split('|')
netName, asList = aList[0], aList[1:]
not gorgeous, but readable
and my instinct for pinning a type is from modula and other
wirthwhile bondage and discipline languages. and, yes, i
see it does not carry.
thanks.
randy
More information about the Tutor
mailing list