How to convert a STRING TO INT in Python and what to do when things go wrong

Опубликовано: 18 Сентябрь 2024
на канале: Python for Everyone
272
4

Python can convert strings to integers and perhaps you have already done that, but what if the string is not a number? Learn how to convert string to int rock-solid!

C H A P T E R S
0:20 Why convert strings to integers
0:56 Can't multiply sequence by non-int of type 'float' Error
1:03 int function
1:25 invalid literal for int() with base 10
2:06 Look before you leap
2:18 Easier to ask for forgiveness than permission
2:50 try except ValueError
3:25 unsupported operand type(s) for *: 'float' and 'NoneType'

M Y O N L I N E T R A I N I N G
Like my style of teaching? Try free chapters of my online courses:

L I N K S I N T H E V I D E O
Python documentation: