This is the response received from third party API
response = [{ print = True },{print = False}]
Now if I access the "print" attribute of that response, it give me with syntax error
for res in response:
print res.print
SyntaxError('invalid syntax', '/home/suman/workspace/kioskinterface/apis/igt.py', 104, 38, '
print ticket.print\n')
The problem must be because of the reserved word. Is there any way around to access "print" attribute from the response.
You can try using getattr:
print getattr(res, 'print')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With