
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How can I convert Python strings into tuple?
Python’s built-in function tuple() converts any sequence object to tuple. If it is a string, each character is treated as a string and inserted in tuple separated by commas.
>>> string="Tutorialspoint" >>> tuple(string) ('T', 'u', 't', 'o', 'r', 'i', 'a', 'l', 's', 'p', 'o', 'i', 'n', 't')
Any non-sequence object as argument results in TypeError.
- Related Articles
- How I can convert a Python Tuple into Dictionary?
- How can I append a tuple into another tuple in Python?
- How can I create a Python tuple of Unicode strings?
- How can I convert Python tuple to C array?
- How can I convert a Python tuple to string?
- How can I convert a Python tuple to an Array?
- How can I convert a Python Named tuple to a dictionary?
- Python program to convert Set into Tuple and Tuple into Set
- How to convert JSON data into a Python tuple?
- How can I do Python Tuple Slicing?
- How to convert python tuple into a two-dimensional table?
- How to convert a list into a tuple in Python?
- How can I convert a bytes array into JSON format in Python?
- How can I use Multiple-tuple in Python?
- How can I subtract tuple of tuples from a tuple in Python?

Advertisements