2

i am working with lists, and there is a function that is returning something that looks like this:

array([0, 5, 3, 3, 0, 1, 2])

how do i cast those values into a list?

what does array mean?

1
  • 4
    What tutorial are you using? Where did you see this code? Commented Aug 3, 2010 at 19:06

1 Answer 1

8

array most likely refers to a numpy.array

myarray = array([0, 5, 3, 3, 0, 1, 2])
mylist = list(myarray)
Sign up to request clarification or add additional context in comments.

1 Comment

for small arrays (30 elements or so on this computer) myarray.tolist() is faster

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.