Seems while learning as I'm going with Python that I'm running into every little roadblock I can.
Even though this is a simply "if" I can't seem to get it to work, and i was wondering if its because my input (pgName) has full stops within the string. e.g com.android.driver.software.
In my example scenario, I will enter com.android.driver.software, what is listed within the Dict.value is com.android.driver.software.7 I thought using the comparison "in" would work in this instance, but it doesn't seem to be handling the logic at all.. What am i doing wrong?
pgName = raw_input("Please enter a package name e.g com.android.driver.software: ")
#while loop that checks user input from pgName to see if it matches any device
#listed in the JSON output and if so printing all the entires for that value.
while True:
try:
jdata = data["result"]["items"][y]["tagValues"]["IdDevicesMap"]["value"]
for device in jdata.values():
if pgName in device:
print jdata[device]
print " "
else:
print 'false'
When i run it everything is false.
Aucun commentaire:
Enregistrer un commentaire