Python: How to loop a list and append it to a dictionary in a loop? : It is for a dynamic ring topology project. Specifically, I need to name each node: s1,s2...sz, and name each host h1-1,h1-2,...hz-n. So z is the number of the nodes, and n is the number of the host connected to each node. So I have a list of the nodes, I am trying to use the node as a key to have another list of hosts, then I can put them in a dictionary for use. Just how can I achieve this goal? The example graph is as below:
[enter image description here][1]


  [1]: https://i.stack.imgur.com/11zBw.png