TypeError: Can only concatenate str (not “int”) to str (simple Python programme)

后端 未结 11 647
逝去的感伤
逝去的感伤 2020-12-07 05:17

I wrote this simple code and tried to execute in Windows 10 CMD ... and it gets the error message :

TypeError: Can only concatenate str (not \"int\") to str
         


        
11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 06:11

    I think this type of error: TypeError: can only concatenate str (not "float") to str

    The reason was Python use comma (,) to stick all element in print() function together. little different from Java that they used plus (+) sign to stick and output the result.

    Note: double check all print() function to see did you put + sign and it should be replace by ,

提交回复
热议问题