If a dictionary key has a Python list as its value!

Liste des GroupesRevenir à cl python 
Sujet : If a dictionary key has a Python list as its value!
De : varunaseneviratna (at) *nospam* gmail.com (Varuna Seneviratna)
Groupes : comp.lang.python
Date : 07. Mar 2024, 16:11:11
Autres entêtes
Message-ID : <mailman.59.1709834551.3452.python-list@python.org>
References : 1
If a dictionary key has a Python list as its value, you can read the values
one by one in the list using a for-loop like in the following.
d = {k: [1,2,3]}

for v in d[k]:
     print(v)
No tutorial describes this, why?
What is the Python explanation for this behaviour?
Varuna

Date Sujet#  Auteur
7 Mar 24 * If a dictionary key has a Python list as its value!2Varuna Seneviratna
7 Mar 24 `- Re: If a dictionary key has a Python list as its value!1ram@zedat.fu-berlin.de (Stefan Ram)

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal