Python Language Arrays Convert array to a python list with same elements using tolist() method

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

When you need a Python list object, you can utilize the tolist() method to convert your array to a list.

my_array = array('i', [1,2,3,4,5])
c = my_array.tolist()
# [1, 2, 3, 4, 5]


Got any Python Language Question?