["python","string","integer","concatenation"]
Python strings and integer concatenation

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?
NOTE: The method used in this answer (backticks) is deprecated in later versions of Python 2, and removed in Python 3. Use the str() function instead. You can use: string = 'string' for i in range(11): string +=`i` print string It will print string012345678910. To get string0, string1 ..... string10 you can use this as YOU suggested: >>> string = "string" >>> [string+`i` for i in range(11)] For Python 3 You can use: string = 'string' for i in range(11): string += str(i) print string It will print string012345678910. To get string0, string1 ..... string10, you can use this as YOU suggested: >>> string = "string" >>> [string+str(i) for i in range(11)]