Convert a Python String to int (Summary)
Congratulations! You’ve learned so much about integers and how to represent and convert them between Python string and int
data types.
In this course, you learned how to:
- Use
str
andint
to store integers - Specify an explicit number system for an integer representation
- Convert a Python string to an
int
- Convert a Python
int
to a string
Now that you know about str
and int
, you can learn more about representing numerical types using float()
, hex()
, oct()
, and bin()
!
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:01
Congratulations! You’ve learned so much about integers and how to represent and convert them between Python string and int datatypes. In this course, you learned how to use str()
and int()
to store integers, how to specify an explicit number system for an integer representation, how to convert a Python string to an int, and how to convert Python int to a string.
00:30 We hope you found this useful, and we’ll see you again soon at realpython.com.
gaurangpopat on May 20, 2020
Short and Sweet!
pommez on May 25, 2020
that is why python is great: even if you think you already know about a topic, you end up learning new awesome features. In this case, for me it was the type representation using the colon notation here: f"{value:b}"
… so cool!
mahlenius on July 16, 2020
Thanks much, good refresher, especially about using the ‘f’ formatted string.
Become a Member to join the conversation.
jamesbrown68 on May 20, 2020
Thanks for a useful course.