python determines whether a string of decimal

"" " 
Exercise to determine a decimal
1, to determine the legality of
2, the legitimate need for a decimal point
3, to the left of the decimal point must be an integer, the right must be a positive integer

" ""

DEF Xiaoshu (S):
xiaoshu_new = str (S)

IF xiaoshu_new. COUNT ( ".") ==. 1:
left, right = xiaoshu_new.split ( ".")
IF left.isdigit () and right.isdigit ():
Print (1111)
return True

elif left.startswith ( '-') left.count and ( '-'). 1 and right.isdigit == ():
lleft left.split = ( '-') [-. 1]
IF lleft.isdigit ():
return True

return False


A Xiaoshu = (-. . 1)

Print (A)

Guess you like

Origin www.cnblogs.com/wangyajuanjuan/p/11588594.html