[Tutor] string.split() into a list

Randy Bush randy at psg.com
Wed Oct 19 01:10:15 CEST 2005


> How about 
>  >>> s='1|2|3|4'
>  >>> l=s.split('|')
>  >>> a, l = l[0], l[1:]
>  >>> a
> '1'
>  >>> l
> ['2', '3', '4']

looks kinda readable.  thanks

randy



More information about the Tutor mailing list