Home > Enterprise >  I am unsure how to fix: 'TypeError: can only concatenate str (not "int") to str '
I am unsure how to fix: 'TypeError: can only concatenate str (not "int") to str '

Time:08-09

new_url = sync_url '/' uri '/data'

I tried new_url = sync_url '/' uri '/str(data)' but I keep getting the same error. I am confused which one is the int. I thought it was data but I keep getting a error code.

CodePudding user response:

Either sync_url or uri are of int type.

To solve your issue, check the type of these variables, and for the int one, you will need to wrap it with str()

For example, if uri is of type int, the following solves the problem:

new_url = sync_url   '/'   str(uri)   '/data'
  • Related