Remove an item from a list given its index instead of its value : Del : Buildin Function PYTHON examples


PYTHON examples » Buildin Function » Del »

 

Remove an item from a list given its index instead of its value


Remove an item from a list given its index instead of its value: the del statement

# Unlike the pop()) method which returns a value, the del keyword is a statement and 
# can also be used to remove slices from a list (which we did earlier by assignment 
# of an empty list to the slice).

a = [-1166.253333331234.5]
del a[0]
print a

del a[2:4]
print a

# del can also be used to delete entire variables:
a = [-1166.253333331234.5]

del a

           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Buildin Function
» Del