
- Python 3 Basic Tutorial
- Python 3 - Home
- What is New in Python 3
- Python 3 - Overview
- Python 3 - Environment Setup
- Python 3 - Basic Syntax
- Python 3 - Variable Types
- Python 3 - Basic Operators
- Python 3 - Decision Making
- Python 3 - Loops
- Python 3 - Numbers
- Python 3 - Strings
- Python 3 - Lists
- Python 3 - Tuples
- Python 3 - Dictionary
- Python 3 - Date & Time
- Python 3 - Functions
- Python 3 - Modules
- Python 3 - Files I/O
- Python 3 - Exceptions
How can I convert a Python tuple to an Array?
To convert a tuple to an array(list) you can directly use the list constructor.
example
x = (1, 2, 3) y = list(x) print(y)
Output
This will give the output −
[1, 2, 3]
Example
If you have a multi-level tuple and want a flat array, you can use the following −
z = ((1, 2, 3), (4, 5)) y = [a for b in z for a in b] print(y)
Output
This will give the output −
[1, 2, 3, 4, 5]
- Related Articles
- How can I convert Python tuple to C array?
- How can I convert a Python tuple to string?
- How I can convert a Python Tuple into Dictionary?
- How can I convert a Python Named tuple to a dictionary?
- How can I convert Python strings into tuple?
- How to convert a tuple into an array in C#?
- How can I append a tuple into another tuple in Python?
- How can I write an SQL IN query with a Python tuple?
- How can I subtract tuple of tuples from a tuple in Python?
- How can I do Python Tuple Slicing?
- How can I convert an array to an object by splitting strings? JavaScript
- How can I create a non-literal python tuple?
- How can I convert a bytes array into JSON format in Python?
- How can I convert the arguments object to an array in JavaScript?
- How can I convert bytes to a Python string?

Advertisements