vendredi 13 décembre 2019

IF ELSE and IF result incomplete [closed]

I am facing issue while fetching value in IF and ELSE command along with IF inside ELSE

list1 = None
list2 = None
list3 = [{'Key': 'Name', 'Value': 'Test1'}]
list4 = [{'Key': 'Name', 'Value': 'Test2'}]

list = [list1,list2,list3,list4]

for x in list:
    if x is None:
        Value = "NO Value"
    else:
        for y in x:
            if y['Key'] == 'Name':
                Value = (y['Value'])
                print (Value)

Results is get: Test1

Test2

Aucun commentaire:

Enregistrer un commentaire