changing list items

eight02645999 at yahoo.com eight02645999 at yahoo.com
Wed Nov 22 20:54:42 EST 2006


hi

say i have a list

alist = ['a','b','c','e','d','f']
I wanted to change the elements , say alist[2:4] .

If i do alist[2:4] = "t" , it gives
['a', 'b', 't', 'd', 'f']  which is not what i want.
I wanted  alist = ['a','b','t','t','d','f']

My list may have more elements, and i may need to replace elements from
different positions,
eg alist[10:15] , alist[30:40] etc..

thanks.




More information about the Python-list mailing list