Assign list to a list item : List Assign « List « Python






Assign list to a list item

Assign list to a list item
 

L = ['Already', 'got', 'one']
L[1:] = []
print L

L[0] = []
print L



           
         
  








Related examples in the same category

1.How to Create and Assign Lists
2.How to Update Lists
3.List: assign by indexList: assign by index
4.List: assign by sliceList: assign by slice