python String转成(float,int,bool)
def transfer(string):
try:
if float(string) == float(int(float(string))):
return int(string)
else:
return float(string)
except:
pass
return True if string.lower() == 'true' else (False if string.lower() == 'false' else string)