Python string to numeric conversion

1. Python can easily convert string types to numeric types:

      1. Direct int

        Usage: int("somestring")

      

      2. string library

       Instructions:

                     string.atoi("somestring"), directly convert the string to int type;

                     sting.atof("somestring"), convert the string to float.

     

2. There are two ways to convert numeric values ​​to strings in Python

       1. str function

       

    2.repr function

      

Related: Python string to numeric conversion