List Problem

dongzhi dongzhi at gmail.com
Wed Dec 10 00:40:08 EST 2008


Hi All,

I have one problem for List. Like that:

format='just "a" ""little"" test'
part = format.split('"')
print part

the result is : ['just ', 'a', ' ', '', 'little', '', ' test']

the list part have 7 element.

If I execute part[1], I have got  'a'. If I execute part[2], I have
got ' '. But, if I execute part[1::2], I have got ['a', '', '']. I
don't know why. Please tell me why.

Thanks.

Best Regards,

Liu Ming



More information about the Python-list mailing list