if not f-int(f):这样判断就行,换成int后相减如果为0,则全为0 f = 5.4t = 6.0000if not f-int(f): print "小数点后全零"else: print fif not t-int(t): print "小数点后全零"else: print t