Skip to content Skip to sidebar Skip to footer

TypeError: Cannot Concatenate 'str' And 'dict' Objects

I am a novice in the field, and I wanted to create a program that was useful and fast handling, and run this script, I get this error, and I could not get this error. # -*- coding:

Solution 1:

the error message should be clear, you can't use + operator to sum a string and a dictionary, maybe you want to convert the dict to a string. If getFTPConfig('Pass') is returning a dictionary then

str(getFTPConfig('Pass'))+"whatever"

Solution 2:

web_response = {2L: 67.0, 3L: 13.67, 4L: 10.25, 5L: 11.8, 6L: 11.83}

I've a dictionary named "web_response",For concatenation of dictionary with string I used comma ","

print "web_response=", web_response

Output:

web_response= {2L: 67.0, 3L: 13.67, 4L: 10.25, 5L: 11.8, 6L: 11.83}

Post a Comment for "TypeError: Cannot Concatenate 'str' And 'dict' Objects"