How to Convert Array to List in Python
In this article, we will see how to convert an array to list in Python
For this, we are using the built-in function in array module. The tolist()
will convert the array to list without loosing any items.
from array import * def array_list(arr): new_list = arr.tolist() #list print(new_list) array = array('i', [54, 12, 543, 212]) #array array_list(array)
Output:
[54, 12, 543, 212]
Subscribe
Login
Please login to comment
0 Discussion