List with one element python
Ngày đăng:
20/12/2021
Trả lời:
0
Lượt xem:
200
Python Tuple With One Item
Python Glossary
Create Tuple With One ItemTo 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. ExampleOne item tuple, remember the commma:
thistuple = ("apple",)
Try it Yourself »
Related PagesPython Tuples Tutorial Tuple Access Tuple Items Change Tuple Item Loop List Items Check if Tuple Item Exists Tuple Length Remove Tuple Items Join Two Tuples
Python Glossary
|