It's possible via:

t = ('275', '54000', '0.0', '5000.0', '0.0')
lst = list(t)
lst[0] = '300'
t = tuple(lst)

But if you're going to need to change things, you probably are better off keeping it as a list

Answer from Jon Clements on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_change_tuple_item.asp
Python Change Tuple Values
Python Examples Python Compiler ... Interview Q&A Python Bootcamp Python Training ... Once a tuple is created, you cannot change its values....
Discussions

Changing individual elements in Tuples
The whole point of tuples is that they are immutable, as the book should have explained. So, no, there is no way of changing an element without creating a new one. More on reddit.com
๐ŸŒ r/learnpython
17
0
July 23, 2024
Changing tuple to list then changing element in list to another from another list then change back to tuple
I have 2 tuples (I think thatโ€™s what they are): fs = 90,30,50,180,90,90,24,90,90 dr = 8,7,6,5,4,3,2,1,0 for num in dr: if num == 0: dr[8] = fs[8] for num in fs: fs[8] = (fs[8])-1 else: pass print("dr =", dr) print() print("fs =", fs) when iterating through dr, if it finds a โ€˜0โ€™, then ... More on discuss.python.org
๐ŸŒ discuss.python.org
4
0
October 29, 2022
Tuples and lists
HI Everyone, Just learning to code and have some questions that I dont understand - any help appreciated: Q1) CAn someone explain why the following has an error on line 2 and no error on line 3 when trying to amend a โ€ฆ More on discuss.python.org
๐ŸŒ discuss.python.org
6
0
July 12, 2021
python replace list values using a tuple - Stack Overflow
You need to enumerate the list and replace the value at the correct index if your criterion is met. (List comprehensions are better for the simple case, but may get ugly for the list of lists and list of tuples). ... I still get confused as to when python makes copies and uses references ... ... Don't be confused, it's really very simple: Python always uses references. ... Except that item in the above is a copy! ... item will actually be a reference to the elements ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Quora
quora.com โ€บ What-is-the-recommended-way-to-replace-an-element-in-a-Python-tuple
What is the recommended way to 'replace' an element in a Python tuple? - Quora
Answer (1 of 5): The recommended way is to use lists rather than tuples, as tuples are immutable objects and therefore cannot be "replaced," but rather a new tuple must be created.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ changing individual elements in tuples
r/learnpython on Reddit: Changing individual elements in Tuples
July 23, 2024 -

As the title states, I'm curious if there's a way to index elements within a tuple. By this I mean overwrite certain elements in a tuple, without having to re-write the whole tuple. I'm currently working through Python Crash Course, and I often find myself going above and beyond the exercises. In this particular book there is no mention of replacing elements in a tuple . I have tried to look this up before asking, but to no avail.

I saw this method on Stack Overflow, but at this point you may as well re-write the whole tuple:

>>> b = (1, 2, 3, 4, 5)
>>> b[:2] + (8,9) + b[3:]
(1, 2, 8, 9, 4, 5)
>>> b[:2] + (8,) + b[3:]
(1, 2, 8, 4, 5)>>> b = (1, 2, 3, 4, 5)
>>> b[:2] + (8,9) + b[3:]
(1, 2, 8, 9, 4, 5)
>>> b[:2] + (8,) + b[3:]
(1, 2, 8, 4, 5)

Is there a faster way?

(edit): The book does mention changing the elements in a tuple, but it's basically rewriting the whole tuple.

I'm basically just looking for a way to use something like the .insert() method, instead of rewriting the whole tuple.

๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ python-program-to-replace-elements-in-a-tuple
Python Program to Replace Elements in a Tuple
Original Tuple is: (11, 22, 33, 44, 55, 66, 77, 88) The updated tuple is: (22, 33, 44, 55, 66, 77, 88) We can slice out the remaining elements of a tuple in the event that the last element needs to be removed.
๐ŸŒ
w3resource
w3resource.com โ€บ python-exercises โ€บ tuple โ€บ python-tuple-exercise-21.php
Python: Replace last value of tuples in a list - w3resource
July 5, 2025 - ... # Create a list of tuples, ... each tuple 't' in the list 'l'. # For each tuple, create a new tuple by removing the last element and adding the number 100....
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-replace-tuple-according-to-nth-tuple-element
Python | Replace tuple according to Nth tuple element - GeeksforGeeks
May 3, 2023 - In this, we just iterate the list element and keep matching the matching Nth element of tuple and perform replacement. ... # Python3 code to demonstrate working of # Replace tuple according to Nth tuple element # Using list comprehension # ...
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_tuples_update.asp
Python - Update Tuples
thistuple = ("apple", "banana", "cherry") del thistuple print(thistuple) #this will raise an error because the tuple no longer exists Try it Yourself ยป ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com ยท If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com ยท HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
๐ŸŒ
Python.org
discuss.python.org โ€บ python help
Changing tuple to list then changing element in list to another from another list then change back to tuple - Python Help - Discussions on Python.org
October 29, 2022 - I have 2 tuples (I think thatโ€™s what they are): fs = 90,30,50,180,90,90,24,90,90 dr = 8,7,6,5,4,3,2,1,0 for num in dr: if num == 0: dr[8] = fs[8] for num in fs: fs[8] = (fs[8])-1 else: pass print("dr =", dr) print() print("fs =", fs) when iterating through dr, if it finds a โ€˜0โ€™, then ...
๐ŸŒ
Analytics Vidhya
analyticsvidhya.com โ€บ home โ€บ how to update a python tuple element value?
How we can update a Python tuple element value?
February 5, 2024 - However, in this article, we will ... can update a Python tuple element value by converting the tuple to a list, making the necessary changes, and then converting it back to a tuple....
๐ŸŒ
Finxter
blog.finxter.com โ€บ 5-effective-methods-to-replace-strings-in-python-tuples
5 Effective Methods to Replace Strings in Python Tuples โ€“ Be on the Right Side of Change
For example, you have a tuple ('apple', ... this task. One common approach to replace an element in a tuple is to unpack its elements, modify the target element, and pack them back into a new tuple....
๐ŸŒ
Finxter
blog.finxter.com โ€บ how-to-change-tuple-values-in-python
How to Change Tuple Values in Python? โ€“ Be on the Right Side of Change
This example uses slicing in combination with the addition operator + to update an existing tuple element and insert an additional element. nums_5day = (11, 12, 13, 14, 15) nums_6day = nums_5day[:2] + (18, 21) + nums_5day[3:] print(nums_6day) The above code declares a Tuple containing projected temperatures for the next five (5) days. The results save to nums_5day. The following line updates this Tuple by replacing an element and inserting an additional element using slicing.
๐ŸŒ
LWN.net
lwn.net โ€บ Articles โ€บ 888945
A method for replacing Python tuple entries [LWN.net]
March 23, 2022 - A recent discussion on the python-ideas mailing list gives some insight into how toโ€”or how not toโ€”propose a feature to be added to the language. At first blush, adding a method to Python's immutable tuple type for replacing one of its elements is not a particularly strange idea, nor one ...
๐ŸŒ
Python Examples
pythonexamples.org โ€บ python-change-tuple-values
Python โ€“ Change Tuple Values
Update the required item of the list. Convert the list back to tuple and assign it to the original tuple. tuple1 = (5, 3, 2, 8, 4, 4, 6, 2) #change tuple to list list1 = list(tuple1) #update list list1[2] = 63 #change back list to tuple tuple1 = tuple(list1) print(tuple1)
๐ŸŒ
Python.org
discuss.python.org โ€บ python help
Tuples and lists - Python Help - Discussions on Python.org
July 12, 2021 - HI Everyone, Just learning to code and have some questions that I dont understand - any help appreciated: Q1) CAn someone explain why the following has an error on line 2 and no error on line 3 when trying to amend a list in a tuple: 1 x = ([1], [2], [3]) 2 x[0] = 4 # Error 3 x[0][0] = 4 # No error Q2) I have letters which is a list of ten letters.
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ python-how-to-replace-tuple-elements-safely-462669
How to replace tuple elements safely | LabEx
In Python programming, tuples are immutable data structures that pose unique challenges when attempting to modify their elements. This tutorial explores safe and efficient techniques for replacing tuple elements, providing developers with essential strategies to work around tuple immutability ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-replace-duplicates-in-tuple
Python | Replace duplicates in tuple - GeeksforGeeks
March 23, 2023 - Initialize a tuple named "test_tup" with some duplicate elements. Print the original tuple. Call the "replace_duplicates" function and pass the "test_tup" tuple as the parameter. Print the resulting tuple after replacing the duplicates.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Add, Update, Remove Tuple Items in Python | note.nkmk.me
April 29, 2025 - In Python, tuples are immutable, meaning you cannot directly add, update, or remove items. If you need mutable data, use a list instead. However, if you need to modify a tuple, you can convert it into ...
๐ŸŒ
Finxter
blog.finxter.com โ€บ 5-best-ways-to-replace-elements-in-a-python-tuple
5 Best Ways to Replace Elements in a Python Tuple โ€“ Be on the Right Side of Change
February 26, 2024 - The code uses the built-in list() function to convert the tuple to a list, replaces the element at the desired index, and then uses tuple() to convert it back to a tuple. Itโ€™s a very intuitive approach. Pythonโ€™s *unpack operator can be used to unpack elements of a tuple.