Python - Convert Int to String

1 min read

Converting an int to a string in Python can be done using the built-in str() method. Typically, you need to do this when concatenating an int and a string.

score = 72
result = 'Your score is: ' + str(score)

print(result)
# Your score is: 72

From Python 3.6 onwards you can also use f-strings which do not require you to convert an integer to a string.

score = 72
result = f'Your score is: { score }'

print(result)
# Your score is: 72



Author picture
Rhett Trickett

Founder at Able

@rhett RhettTrickett rhetttrickett
Python

Join the discussion

Able is a developer community where people build their coding knowledge and careers.

Join with GitHub Join with Twitter