Python Tuple With One Item
Create Tuple With One Item
To create a tuple with only one item, you have add a comma after the item, unless Python will not recognize the variable as a tuple.
Example
One item tuple, remember the commma:
thistuple = ("apple",)
print(type(thistuple))
#NOT a tuple
thistuple = ("apple")
print(type(thistuple))
Try it Yourself »