Prerequisite : Array in Python
Python program to convert an array to an ordinary list with the same items.
Input : array('i', [1, 3, 5, 3, 7, 1, 9, 3]) Output :[1, 3, 5, 3, 7, 1, 9, 3] Explanation: the array with elements [1, 3, 5, 3, 7, 1, 9, 3] are converted into list with the same elements. Input :array('k', [45, 23, 56, 12]) Output :[45, 23, 56, 12] Explanation: the array with elements [45, 23, 56, 12] are converted into list with the same elements.
Approach to the problem:
We want to convert an array into an ordinary list with the same items. For doing so we need to use a function
// This function tolist() converts the array into a list. arrayname.tolist()
[45, 34, 67]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Ordinary Least Squares (OLS) using statsmodels
- Python - Convert dictionary items to values
- Python program to convert URL Parameters to Dictionary items
- Python | Convert list of string to list of list
- Python | Convert list of tuples to list of list
- Python | Convert List of String List to String List
- Python | Insert the string at the beginning of all items in a list
- Python | Count number of items in a dictionary value that is a list
- Python | Associating a single value with all list items
- Python - Get sum of last K list items using slice
- Python - Common items Dictionary Value List
- Python - Assign list items to Dictionary
- Python - Extract dictionary items with List elements
- Python - Retain list elements value items
- Python - Group Similar items to Dictionary Values List
- Python - Sort List items on basis of their Digits
- Python | Replace elements in second list with index of same element in first list
- Python | Convert a nested list into a flat list
- Python | Convert list of strings and characters to list of characters
- Python | Convert a string representation of list into list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.