Question:

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

Answer:

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.

 


Keywords:

© 2017 QuizBucket.org