Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concatenate 'str' and 'NoneType' objects [duplicate]

I try to stock string in my database with python script. But but when running the code I have this error cannot concatenate 'str' and 'NoneType' objects.

How can i decode this string "Poste Si\xe8ge" to be stocked successfully

    insert="INSERT INTO blacklist VALUES(INET_ATON('"+ long2ip(row[0]) +"'),NOW(),'"+ check.country +"',4,' ','"+detect[0]+"','"+ispTarget[0]+"')"

detect[0]=Poste Si\xe8ge

TypeError: cannot concatenate 'str' and 'NoneType' objects

Help me plz

like image 544
jarmouz Avatar asked Jan 16 '15 09:01

jarmouz


1 Answers

Did you try str() in-built function.?

If you concatenate string objects with other data types, then the other type has to be converted to str(other_data_type)

Hope this helps you.

like image 182
M.A Majid Avatar answered Sep 29 '22 12:09

M.A Majid