Python graph selecting values inside a list

Viewed 46

Hello all how do I select just the first columns for this list so I only want to grab 1-11 and not the things inside the []

thank you!!

graph = {1: [9],

2: [3],

3: [4],

4: [6],

5: [6],

6: [8],

7: [2,8,9],

8: [11],

9: [],

10: [],

11: [10],


}
1 Answers

Your question is unclear, the input you provide is a dictionary. If you just want to grab the 1-11, that would be the dictionary keys: graph.keys()

Related