lundi 19 novembre 2018

Python: Nested List Loop

I would like to loop the nest list"['sally','joe'] in the example shown below.

data = ['joe','mike',['sally','joe'],'phil']

I attempted the following:

for i in data:
    for j in (i):
        if type(j) == '<class '+"'list'>":    
            print(j)

Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire