changing list items

E

eight02645999

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,779
Messages
2,569,606
Members
45,239
Latest member
Alex Young

Latest Threads

Top