Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

are tuples mutable

# Trying to change their values results in an error.
tup = (10, "20", 20, 30, "Thirty-five", 50)
tup[0] = 1# Trying to change the first value of the tuple to 1. This raises an error.
# Tuple object does not support assigment.
Comment

are tuples in python mutable

>>> dum = ('1861-10-23', ['poetry', 'pretend-fight'])
>>> dee = ('1861-10-23', ['poetry', 'pretend-fight'])
>>> dum == dee
True
>>> dum is dee
False
>>> id(dum), id(dee)
(4313018120, 4312991048)
Comment

PREVIOUS NEXT
Code Example
Python :: loop through list of tuples python 
Python :: transpose array python 
Python :: pandas merge but keep certain columns 
Python :: construct contingency table from pandas 
Python :: convert index of a pandas dataframe into a column 
Python :: isistance exmaple 
Python :: how to print thgings in multiple linew in python 
Python :: get only first 10 columns pandas 
Python :: changing the current working directory in python 
Python :: python socket check if still connected 
Python :: python ssl module is not available 
Python :: how to update python 
Python :: how to catch ctrl c in python 
Python :: how to drop a column in python 
Python :: create a new dataframe from existing dataframe pandas 
Python :: np to tuple 
Python :: how to create a tuple from csv python 
Python :: python subtract lists 
Python :: find where df series is null and print 
Python :: mongodb get first 10 records 
Python :: flask flash not working 
Python :: Adjusting Subplot Margins in Matplotlib 
Python :: fillna with mode pandas 
Python :: set index in datarame 
Python :: basic tkinter gui 
Python :: enable debug mode flask 
Python :: load img cv2 
Python :: delete nans in df python 
Python :: pandas column name equal to another column value 
Python :: python http.server 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =