Python 3 - Array in Array -


I started learning Python3 just about a week and half before. Now the books cover the catalogs, topless and directories. I hope my question is not dumb, but I can not find the answer anywhere.

Say, I have a list of names with people's age:

  Klaus, 34 Doris, 20 Mark, 44 Tina, 19    

In this, php will look like this:

  $ multiarray = array (array (name = & gt; "Peter", age => 34), array (name = & gt; "Doris", age => 20), array (No M = & gt; "mark", age => 44), array (name = & gt; "tina", age => 19));           In Python , This will probably  list  of  dict  anionary: 

  Multicore = [{"name": "Peter", "age": 34}, ...]   

eg Peter's age

  multiarray [0] ["age"]   

Just saw your comment, note that you can do

 : print ("{0 [name]} is [age]} years old." Format (person)   

Manually index Amplify i is not very graphical: you either:

  1. directly replace items ( in items );
  2. Use calculate to get the object and index ( for the index, items in the value (list) ); Use category to generate the index ( for category (lane)) ).

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -