您好,我正在使用 python 并希望将 JSON True 或 False 连接到我的代码,所以 if "dummy": "True" do ... else: do ... My JSON
[
{
"profilename": "Test3",
"email": "email@outlook.com",
"password": "Password2*",
"payment": "Paypal",
"product": "https://www.unkown.de/de/product/",
"Dummy":"False"
},
{
"profilename": "Test1",
"email": "email@gmail.com",
"password": "Password1*",
"payment": "Paypal",
"product": "https://www.unkown.de/de/product/",
"Dummy":"True"
}
]
我的python代码:
profile_name = "Test3"
with open('Data2.json', 'r') as handle:
json = json.load(handle)
data = [x for x in json if x['profilename'] in profile_name]
email = (data[0]['email'])
password = (data[0]['password'])
payment = (data[0]['payment'])
product = (data[0]['product'])
dummy = (data[0]['dummy'])
def getLogin():
if dummy = "True": <----- This doesnt work, want to get this fixed
import Script2
else:
print("starting login process")
所以就像 if "Dummy": "True" 它应该满足 if 条件, if "dummy": false 它应该满足 else 条件,我该怎么做?