How Will You Convert A String To A Number In Python?


Python provides the <int()> method, a standard built-in function to convert a string into an integer value.

You can call it with a string containing a number as the argument, and it returns the number converted to an actual integer.

print int("1") + 1
The above prints 2.



© 2017