![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python program to convert an array to an ordinary list with the same items
The array is given. Our task is to convert an array to an ordinary list. We solve this problem with the help of tolist() function. This function return the array as a (possibly nested) list.
Algorithm
Step 1: Given an array. Step 2: convert the array to a list using tolist() function. Step 3: Display list
Example Code
#Python program to convert an array to an ordinary #list with the same items from array import * def arraytolist(A): lst = A.tolist() # list print("The List Is ::>",lst) # Driver code A= array('i', [20,30,60]) # array arraytolist(A)
Output
The List Is ::> [20, 30, 60] The List Is ::> [20, 30, 60]
Advertisements