Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

update tupple in python

#Convert the tuple into a list to be able to change it:
  
x = ("apple", "banana", "cherry")
y = list(x)
y[1] = "kiwi"
x = tuple(y)

print(x)

#Convert into a list
#Convert the tuple into a list, add "orange", 
#and convert it back into a tuple:

thistuple = ("apple", "banana", "cherry")
y = list(thistuple)
y.append("orange")
thistuple = tuple(y)


#Add tuple to a tuple.
#Create a new tuple with the value "orange", and add that tuple:
  
thistuple = ("apple", "banana", "cherry")
y = ("orange",)
thistuple += y

print(thistuple)
Comment

PREVIOUS NEXT
Code Example
Python :: how to include specific data type from the dataframe 
Python :: get datafram colum names as list python 
Python :: venv upgrade python 
Python :: flask give port number 
Python :: python strftime microseconds 
Python :: pandas groupby without reset index 
Python :: how to split a string from the beginning to a specific character in python 
Python :: pyqt5 message box 
Python :: importing tkinter in python 
Python :: upgrade to latest django version 
Python :: how to activate virtual environment in python 
Python :: python pickle save and load multiple variables 
Python :: grouping products for sales 
Python :: how to import PyMem python 
Python :: get all paragraph tags beautifulsoup 
Python :: django q filter 
Python :: left join two dataframes pandas on two different column names 
Python :: python one line return 
Python :: python memoization 
Python :: access dataframe column with space 
Python :: reverse order np array 
Python :: python open dicom file 
Python :: python open website 
Python :: dataframe auto detect data types 
Python :: how to make player quit in python 
Python :: pickle load 
Python :: python csv delete specific row 
Python :: position in list python 
Python :: filter an importrange 
Python :: jinja len is undefined 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =