Convert an integer to a string in Python

David Y.

The Problem

How do I convert an integer to a string in Python?

The Solution

We can do this using Python’s built-in str() function.

my_integer = 100 my_string = str(my_integer) # my_string will equal "100"

This function works by calling the __str__() method on the provided object.

Join the discussionCome work with us
Share on Twitter
Bookmark this page
Ask a questionImprove this Answer

Related Answers

A better experience for your users. An easier life for your developers.

    TwitterGitHubDribbbleLinkedin
© 2023 • Sentry is a registered Trademark
of Functional Software, Inc.