changing list items

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Nov 22 21:14:58 EST 2006


A possibile first solution:

>>> alist = ['a','b','c','e','d','f']
>>> inf, sup = 2, 4
>>> alist[inf:sup] = ["t"] * (sup - inf)
>>> alist
['a', 'b', 't', 't', 'd', 'f']

Bye,
bearophile




More information about the Python-list mailing list