Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python list pop multiple

# Removes (Pops) the last 6 items from a list
del myList[-6:]
# Removes the second item from a list (index starts at 0)
myList.pop(1)
# Slices the list and keeps only the first 6 items
myList = myList[:6]
Comment

list pop multiple elements python

mylist=['a','b','c','d','e','f','g','h','i']
newlist = mylist[2:-2]
Comment

PREVIOUS NEXT
Code Example
Python ::  
::  
Python ::  
:: insert column in a dataframe 
::  
Python :: get list with random numbers python 
::  
:: select multiple dict 
Python :: tuple comprehension python 
Python :: how to get value from set in python 
Python :: absolute value in python 
:: how to get a summary of a column in python 
::  
::  
::  
Python :: how to shuffle array in python 
:: python unresolved import vscode 
::  
::  
Python :: python timeout exception 
::  
Python :: tryexept in python 
Python ::  
::  
Python ::  
:: how to extract field values in list from queryset in django 
Python ::  
:: pandas dataframe sort by column 
Python ::  
Python :: how to make python 3 default on mac 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =