print ("Tag Value " + i.tags.get('Name'))
gives me:
File "./boto_test.py", line 19, in main
print ("Tag Value" + i.tags.get('Name'))
TypeError: cannot concatenate 'str' and 'NoneType' objects
What is the correct way to do this?
Or just convert whatever you get
from i.tags
to string:
print ("Tag Value " + str(i.tags.get('Name')))
i.tags
doesn’t contain a 'Name'
key. What should the result be for None
? Just pass it as a second argument to get
:
print ("Tag Value " + i.tags.get('Name', 'None'))
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