>>> str(42)
'42'

>>> int('42')
42

Links to the documentation:

  • int()
  • str()

str(x) converts any object x to a string by calling x.__str__(), or repr(x) if x doesn't have a __str__() method.

Answer from Bastien Léonard on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › convert-integer-to-string-in-python
Convert Integer to String in Python - GeeksforGeeks
%s placeholder inserts values into a string and automatically converts them to string format. ... Explanation: %s acts as a placeholder for the value and Python converts the integer into a string before inserting it.
Published: May 27, 2026
Discussions

How do I get an integer as a string?
Why is 10.0 printed For me it prints "10" (as it should). Perhaps some other part of your code or the environment is affecting what you see. More on reddit.com
🌐 r/learnpython
11
8
May 14, 2024
how are you supposed to add an integer to a string?
If what you want is mathematical addition (i.e. you'd want 1 and "2" to add to 3), then yes, you want to convert the string to an int first using int() (or, if it's not actually an integer, to float using float()). If what you want is string concatenation (i.e. you'd want 1 and "2" to add to "12"), then you'll either need to convert the integer to str first or use f strings or the format method etc. More on reddit.com
🌐 r/learnpython
20
9
March 24, 2024
Cannot use str() to convert an int to a string.
Is maxhealth and maxhunger also integers? print(f"\nHealth: {healthstat}/{maxhealth}") More on reddit.com
🌐 r/learnpython
13
23
January 18, 2022
i am a beginner at python and im trying to convert string to int but it doesn't work
What? You can't convert "sadsad" to an int. What would that even mean? Don't you mean you want to convert the integer 170 to a string, instead? More on reddit.com
🌐 r/learnpython
21
1
August 8, 2023
🌐
FavTutor
favtutor.com › blogs › int-to-string-python
Convert Int to String in Python (6 Ways) | FavTutor
July 18, 2026 - In Python, the standard way to convert an integer to a string is the built-in str() function.
🌐
Replit
replit.com › home › discover › how to convert an int to a string in python
How to convert an int to a string in Python | Replit
April 14, 2026 - In this article, you'll explore key techniques, from the str() function to modern f-strings. We'll also provide practical tips, examine real-world applications, and offer advice to help you resolve common errors with your code.
🌐
Mimo
mimo.org › tutorials › python › how-to-convert-integer-to-string-in-python
How to Convert Integer to String in Python
Learn how to convert an int to a string in Python with str() and f-strings, avoid TypeError, and build clean filenames and messages.
🌐
W3Schools
w3schools.in › python › examples › convert-int-to-string
Python Program to Convert Int to String - W3schools
Using f-strings feature (available in Python 3.6 and above). Using % operator (also known as the "string formatting operator"). To convert an integer to a string in Python, the str() function can be used. This function takes an integer as an argument and returns the corresponding string ...
🌐
Python Guides
pythonguides.com › convert-int-to-string-in-python
Convert Integer to String in Python (5 Easy Ways)
3 weeks ago - Convert an integer to a string in Python with str(), f-strings and format(), plus leading zeros, commas, hex, lists of ints and the 4,300-digit limit.
Find elsewhere
🌐
Unstop
unstop.com › home › blog › convert int to string in python (6 methods with examples)
Convert Int To String In Python (6 Methods With Examples)
April 11, 2024 - One common approach to convert int to string in Python is to use built-in functions like str(), which directly converts an integer to its string representation. For instance, str(123) returns the string '123'.
🌐
Scaler
scaler.com › home › topics › how to convert int to string in python
How to Convert int to string in Python - Scaler Topics
May 12, 2024 - ... The syntax for using the %s keyword is enclosing %s in quotation marks and then writing % integer after it. ... The syntax for using the .format() function in int to string conversion is using it with an empty string and then writing the integer value inside parenthesis.
🌐
Linuxize
linuxize.com › home › python › how to convert integer into string in python
How to Convert Integer into String in Python | Linuxize
1 month ago - Convert an int to a str in Python with str(), f-strings, and format(), add leading zeros, build binary or hex strings, and join a list of numbers.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-convert-integers-to-strings-in-python-3
How To Convert Integers to Strings in Python 3 | DigitalOcean
September 3, 2020 - We can convert numbers to strings using the str() method. In this quick tutorial, you’ll learn how to use this method to convert integers to strings.
🌐
Medium
medium.com › @rajguleria3 › how-to-convert-int-to-string-in-python-python-tutorial-2b9202cb054a
How to convert int to string in Python — Python Tutorial | by Rajguleria | Medium
January 14, 2023 - We can convert an integer data type using the Python built-in str() function. This function takes any data type as an argument and converts it into a string. But we can also do it using the “%s” literal and using the .format() function.
🌐
Career Karma
careerkarma.com › blog › python › python string to int() and int to string tutorial: type conversion in python
Python String to Int() and Int to String Tutorial: Type Conversion in Python
December 1, 2023 - Use the syntax print(str(INT)) to return the int as a str, or string. When learning how to code with Python, students quickly find that Python includes a number of data types that are used to distinguish a particular type of data.
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-convert-int-to-string-in-python
How to convert int to string in Python?
March 25, 2026 - Python has a built-in function str() to convert an integer to a string.
🌐
Medium
mechatronicslab-net.medium.com › how-to-convert-an-integer-to-a-string-in-python-9b0724f73cd8
How to Convert an Integer to a String in Python | by MechatronicsLAB | Medium
March 20, 2025 - The format() function is another approach to convert integers to strings. ... This method is useful when formatting multiple variables in a string. Older Python versions (before Python 3.0) use the % operator for formatting.
🌐
Programming Idioms
programming-idioms.org › idiom › 55 › convert-integer-to-string › 575 › python
Convert integer to string, in Python
Create the string representation s (in radix 10) of the integer value i. ... def parse(value): if value < 10: return digits[value] n, index = divmod(value, 10) return parse(n) + digits[index] s = parse(i) ... S = integer_to_list(I).
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-string-to-int-int-to-string
Python String to Int, Int to String | DigitalOcean
August 4, 2022 - From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
🌐
GeeksforGeeks
geeksforgeeks.org › videos › convert-integer-to-string-in-python
Convert integer to string in Python - GeeksforGeeks | Videos
Displaying Data: When displaying data on a webpage or in reports, you may need to convert integers into a readable string format for better presentation. Python provides several straightforward methods for converting integers to strings:
Published: November 13, 2024
Views: 12K
🌐
SheCodes
shecodes.io › athena › 2142-converting-an-integer-to-string-in-python
[Python] - Converting an Integer to String in Python - | SheCodes
Learn how to convert an integer to a string in Python by using the `str()` function or casting the integer as a string.