Crawler 005_python type conversion_other types converted to integer_converted to Float type_converted to string_converted to Boolean---python work notes 023

15940897:

First of all, it is very simple to convert a string to an int

 

Converting float to int will discard the content after the decimal point

 

boolean converted to int true is 1 false is 0

 

Then convert the string to an int. Be careful not to have special characters, such as 1.23, if there is a bit, an error will be reported.

 

The above string is 12ab, and if there is ab, an error will also be reported

 

look up

 

Guess you like

Origin blog.csdn.net/lidew521/article/details/131988100