Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

discard vs remove python

list = [1, 2, 3, 4, 5]
list.remove(0)	//removes element in specified position
print(list)
>> [2, 3, 4, 5]
list.discard(2)	//discards element if found in iterable (in list in this case) ;)
print(list)
>> [3, 4, 5]
Comment

PREVIOUS NEXT
Code Example
Python :: import models 
Python :: python connect sftp with key 
Python :: create folders in python 
Python :: python wait 5 seconds then display 
Python :: close selenium webdriver python 
Python :: rotate image pyqt5 
Python :: calculator in one line in python 
Python :: how to open cmd at specific location usng python 
Python :: delete files inside folder python 
Python :: python append to file 
Python :: increase pie chart size python 
Python :: mean of a list python 
Python :: Removing punctuation in Python 
Python :: python get keypressed value 
Python :: python show image opencv 
Python :: python shortest path of list of nodes site:stackoverflow.com 
Python :: pages.User Settings.user: (fields.W342) Setting unique=True on a Foreign Key 
Python :: how to increase and decrease volume of speakers using python 
Python :: choose random index from list python 
Python :: how to move mouse with pyautogui 
Python :: create new column using dictionary padnas 
Python :: python volver al principio 
Python :: how to recurse a function 
Python :: how to shutdown your computer using python 
Python :: pyplot legend outside figure 
Python :: how to make a module that generates a random letter in python 
Python :: how to iteratively create a grid within a bigger grid in python 
Python :: youtube to mp3 python 
Python :: image from wikipedia module in python 
Python :: python date now plus days 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =