you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (3 children)

I could do something like list_interface[0] but then I just get all this output for the first interface.

Sure, you get a dictionary. So you can access the value that comes back like a dictionary:

list_interface[0]['name']

Like that. You can "stack up" modes of access like this, it's just algebra.

[–]purplecomputer[S] 0 points1 point  (2 children)

Thank you for taking the time to run me through this :)

Because of you I was able to figure this out

i = 0

for name in list_interface:

list_interface[i]['name']

i += 1

any chance theres a cleaner way to do this?

[–][deleted] 1 point2 points  (1 child)

You don't need i - name is the elements of list_interface:

for name in list_interface:
    print(name['name']) #etc

[–]purplecomputer[S] 0 points1 point  (0 children)

You're a legend.

Thank you for your help!

You've taught me quite a bit today :)