Python: int to string - how it works
On this page, we show how you can easily convert an integer to a string ("int to string"). Because programming with Python is not that difficult.
Convert integer to string: Python guide
When programming with Python, an integer is used for an integer. Sometimes, however, you have to convert this into a string. For example, if you want to write the integer (for example, as a number) to a file.
- You can easily convert an integer into a string using the "str ()" function. Simply write a variable or an integer in the brackets. If the variable "a" has the value 3, you can output this value as a string using the "str (a)" function (without quotation marks).
- However, the whole thing works the other way round: With the "int ()" command, a value is output as an integer.
- The "float ()" function is also very practical. You can use this to convert an integer or string into a floating point number.
More tips about Python in our CHIP guides
Tip: You can find further programming tutorials on our Python programming language topic page. There we show you, for example, the most important standard commands for Python beginners.