0

In php I can declare array inside an array like this:

$top_array['array1']['array2'] = array('Tom' => '21',
                                       'Tim' => '22');

how do you do that in python?

1

1 Answer 1

0

In Python

array1 = [ array2 ]

For example :

array2 = [1, 2, 3]
array1 = [ array2 ]

result will be

array1 = [[1,2,3]]

Here array1 is an array of another array named array2

Similarly we can put multiple arrays in array1 like :

array1 = [array2, array3, ...]

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, that's exactly what I needed 👍

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.