In Python, how can I parse a numeric string like "545.2222"
to its corresponding float value, 542.2222
? Or parse the string "31"
to an integer, 31
?
I just want to know how to parse a float string
to a float
, and (separately) an int string
to an int
.
转载于:https://stackoverflow.com/questions/379906/how-do-i-parse-a-string-to-a-float-or-int-in-python