배열이 주어집니다. 우리의 임무는 배열을 일반 목록으로 변환하는 것입니다. 우리는 tolist() 함수의 도움으로 이 문제를 해결합니다. 이 함수는 배열을 (중첩된) 목록으로 반환합니다.
알고리즘
Step 1: Given an array. Step 2: convert the array to a list using tolist() function. Step 3: Display list
예시 코드
#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)
출력
The List Is ::> [20, 30, 60] The List Is ::> [20, 30, 60]