Splitting strings

Janne Sinkkonen janne at nnets.fi
Wed Oct 18 11:00:39 EDT 2000


joonas <keisari_ at hotmail.com> writes:

> i have a string "8643" how can i split it into variables:
> firstvar, secondvar, thirdvar and fourthvar.
> 
> Then variables would contain:
> 
> firstvar = 8
> secondvar = 6
> thirdvar = 4
> fourthvar = 3

>>> a,b,c,d='1234'
>>> a
'1'
>>> b
'2'
>>> c
'3'
>>> d
'4'
>>>                                                                         



More information about the Python-list mailing list