To create a Python tuple containing one value, put a comma after the value: one_item = (value,). The comma makes it a tuple; parentheses alone only group an expression.
Write a comma after the value
Use this form for a one-element tuple:
single = ('hello',)
print(single) # ('hello',)
Python’s language reference requires a trailing comma when a tuple display has exactly one element. The comma-separated values define the tuple; parentheses are often used to make the tuple’s boundaries clear. See the Python language reference.
As an Amazon Associate I earn from qualifying purchases.
Why (value) is not a tuple
Parentheses by themselves group an expression. So ('hello') evaluates to the string 'hello', while ('hello',) evaluates to a tuple containing that string.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →not_a_tuple = ('hello') # a string
one_item = ('hello',) # a one-element tuple
Examples with different values
The same comma rule applies regardless of the value’s type:
#1 Best Overall
number = (42,)
text = ('hello',)
flag = (True,)
none_value = (None,)
Other tuple forms
()creates an empty tuple.(first, second)creates a tuple with two values. A final comma is optional when there is more than one element.value,is also tuple syntax in a context that accepts a comma-separated expression list, though(value,)makes the intent more obvious.
PEP 8 likewise says that a trailing comma is mandatory for a one-element tuple: When to Use Trailing Commas.
Quick Recap
Best Value
Rank #2
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.




