I did some research on how to use named array from PHP in python, while i found the following code example as they said can be done with dictionary.
shows = [
{"id": 1, "name": "Sesaeme Street"},
{"id": 2, "name": "Dora The Explorer"},
]
Source: Portion of code getting from here
Reference: Python references
But how could i adding a new value through a loop? While the references shown on how to adding single value by simply shows[‘key’]=”value” but i can’t linking both of them. Can anyone please show me how to add the value into this dictionary through a loop?
For example:
for message in messages:
myvariable inside having two field
- Message
- Phone number
Update
May i know how could i loop them out to display after aped list into dictionary? Thanks!
You should be adding the dictionary into an array like :
to loop again, you can do it this way :