Can I write all "append" code in a row using "if"?
how can I in python append by condition, can i write like this?
'Segment 2': result['trips'][0]['segments'][2]['bookingClass']) if(len(result['trips'][0]['segments'] == 2,
at the moment i try to write all in one row, is this possible?
response.append({'Fare Type': result['fareType'], 'Segment 2': result['trips'][0]['segments'][2]['bookingClass']) if(len(result['trips'][0]['segments'] == 2})
Comments
Post a Comment