mrstephengross wrote: >>But, assuming you have your numbers as strings, I would suggest > > looking > at str.split() and len(). > > Well, the numbers are in fact stored as numbers, so string processing > won't work.
How about: py> def digits(f): ... return len(str(f).split('.')[1].rstrip('0')) ... py> for f in [0.103, 0.1030, 0.0103, 0.010300]: ... print f, digits(f) ... 0.103 3 0.103 3 0.0103 4 0.0103 4 I believe the rstrip is unnecessary because I think str() will never produce additional following zeros, but you can guarantee it by calling rstrip if you want. Note that, for example, 0.103 and 0.1030 are identical as far as Python is concerned, so I hope you're not hoping to show a difference between these two... STeVe -- http://mail.python.org/mailman/listinfo/python-list