Way to fetch value from list using python

Hi all

I have a list with the below values
[[‘app01’,’app02’],[‘10.10.10.1’,’10.10.10.2’],[‘app03’],[‘10.10.10.3’]]

We need to manipulate the above list and get the result as below

App01, 10.10.10.1
App02, 1010.10.2
App03, 10.10.10.3
How do I get the values like above from the list

Thanks in advance

Regards

Rajesh

You want to iterate over pairs of the outer list. One way to do that is using the same iterator twice in a zip():

data = [['app01','app02'],['10.10.10.1','10.10.10.2'],['app03'],['10.10.10.3']]
it = iter(data)
for list1, list2 in zip(it, it):
    for n, v in zip(list1, list2):
        print(n, v)