adding a character to the last string element of a list

Philippe C. Martin philippe at philippecmartin.com
Wed Jul 6 01:28:12 CEST 2005


Hi,

I have the following question:

l = ['ABCDE','FGHI']
l[1:] #returns ['FGHI']
l[1:][0] #return 'FGHI'

a = l[1:][0] + 'J' #a becomes 'FGHIJ'

l[1:][0] += 'J' #NO ERROR BUT l[1:][0] == 'FGHI'


What am I missing ?

Thanks,

Philippe







More information about the Python-list mailing list