News

We then pass this variable as an argument to the str() function, which converts it to a string and assigns the result to the variable ‘str_num’. Finally, we print the value of ‘str_num’. Method 2: ...
To convert a string to an integer in Python, use the built-in int() function. This function takes a string as an argument and returns its integer representation. For example, int('123') will ...