我正在尝试编写一个if语句,该语句不附加“id”“1062066”,但它不起作用
我的代码:
if not event['id'] in ['1062066']
JSON:
"id":1062066,
"number":9,
"name":"COASTAL MIDWEST TRANSPORT HANDICAP",
"startsAt":"2020-10-03T09:25:00+00:00",
"url":"https:\/\/www.odds.com.au\/horse-racing\/kalgoorlie\/race-9\/?date=2020-10-03",
"isAbandoned":false,
"resulted":false,
"results":null,
"meetingId":184543,
"regionIconUrl":"https:\/\/puntcdn.com\/flags\/@2x\/AU@2x.png",
"regionName":"Australia"
试试这个
if not str(event['id']) == str(1062066):
JSON响应中的
id
类型为int
。您需要将id转换为str
以进行检查相关问题 更多 >
编程相关推荐