When I am trying to write a small python script I got following error:
TypeError: cannot concatenate ‘str’ and ‘int’ objects
Example code where we can reproduce similar error is below:
a=1 b=2 c=a+b print 'sum is ' + c
After debugging above error the root cause for it is ‘sum is’ a string an c is an integer, since both are different types print statement is unable to concatenate them.
So I just changed the last line of above as below and the script is worked without any issue.
print 'sum is ' + str(c)