Python strings and integer concatenation [duplicate]

I want to create a string using an integer appended to it, in a for loop. Like this:

for i in range(1, 11):
  string = "string" + i

But it returns an error:

TypeError: unsupported operand type(s) for +: ‘int’ and ‘str’

What’s the best way to concatenate the string and integer?

9 Answers
9

Leave a Comment