我正在尝试使用QPX Express。我要保存机场的出发地和目的地的每个循环结果。当我发送JSon请求(Origin:ORY/Designation:LAX/Solution 2)时,我通常有2个航班(可能有航班连接)。在
multivol = data['trips']['tripOption']
origine_air = []
destination_air = []
for p in multivol :
print("")
multivol1 = p['slice']
prix = p['saleTotal']
print prix
for q in multivol1 :
multivol2 = q['segment']
duree_trip = q['duration']
duree_trip_h = duree_trip // 60
print duree_trip_h
for s in multivol2 :
multivol3 = s['leg']
for d in multivol3 :
ori = d['origin']
dest = d['destination']
heure_ar = d['arrivalTime']
heure_de = d['departureTime']
vol_entier = ori + dest
print vol_entier
origine_air.append(ori)
我试图把结果存储在一个列表中。在
我的结果:
^{pr2}$名单的结果不是我所期望的。当你可以看到从奥利到洛杉矶有一个航班在LRH(伦敦)转机,在列表中只有第一个航班(ORY到LHR),而不是第二个部分。在
我怎么能把所有的行程都列在我的单子上?在
谢谢你
罗宾
您的主要关注点似乎是解析一个字符串a,将令牌存储到一个列表中。也许这就是你需要的?在
输出
^{pr2}$相关问题 更多 >
编程相关推荐