In Python, use int() function to convert a string to int (integer).
INT() Function Example
a_string = "23" n_int = int(a_string) n_sum = n_int + 10 print(n_sum)
Output
33
But if the value of a string is in double, then you will get the error. For example:
a_string = "23.98" n_int = int(a_string) n_sum = n_int + 10 print(n_sum)
Output
ValueError: invalid literal for int() with base 10: '23.98'