Assignment to slices: Replace some items : List Element Replace « List « Python






Assignment to slices: Replace some items

Assignment to slices: Replace some items

a = ['spam', 'eggs', 100, 1234]
# Replace some items:
a[0:2] = [1, 12]
print a

           
       

Related examples in the same category