meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| programming:python:syntax:collections:tuples [2024/03/01 07:37] – ↷ Page moved from programming:python:syntax:types:tuples to programming:python:syntax:collections:tuples niziak | programming:python:syntax:collections:tuples [2024/03/01 08:51] (current) – niziak | ||
|---|---|---|---|
| Line 16: | Line 16: | ||
| </ | </ | ||
| + | ===== " | ||
| + | |||
| + | Tuples are immutable. Only way is to create new tuple using temporary list. | ||
| + | |||
| + | <code python> | ||
| + | t = (' | ||
| + | t_new = t + (' | ||
| + | |||
| + | l = list(t) | ||
| + | |||
| + | l.insert(' | ||
| + | l[1] = ' | ||
| + | l.remove(0) | ||
| + | |||
| + | t_new = tuple(l) | ||
| + | </ | ||