a = "123456-" b = "-11111111111.212345678975" c = "4.773-101" import re #美元符号,匹配一个字符串的结尾或者字符串最后面的换行符 #print "a",re.match(r"\d+$",a) and True or False #print "b",re.match(r"\d+\.$",b) and True or False print "b",re.match(r"-?\d*\.?\d*(e-\d+)?\d$",b) and True or False print "a",a) and True or False print "c",c) and True or False