Re: String manipulations
- From: Elliot Temple <curi@xxxxxxx>
- Date: Sat, 28 May 2005 15:16:20 -0700
On May 28, 2005, at 2:52 PM, Lorn wrote:
Yes, that would get rid of the decimals... but it wouldn't get rid of the extraneous precision. Unfortunately, the precision out to the ten thousandth is noise... I don't need to round it either as the numbers are artifacts of an integer to float conversion. Basically, I need to know how many decimal places there are and then make the necessary deletions before I can normalize by adding zeros, multiplying, etc.
Thanks for your suggestion, though.
for s in numbers: decimal_index = s.find('.') decimal_places = len(s) - decimal_index - 1
Anything wrong with this? (it will mess up if there isn't a decimal but you can fix that if you want)
-- Elliot Temple http://www.curi.us/
--- [This E-mail scanned for viruses by Declude Virus]
.
- Follow-Ups:
- Re: String manipulations
- From: Lorn
- Re: String manipulations
- References:
- String manipulations
- From: Lorn
- Re: String manipulations
- From: Philippe C. Martin
- Re: String manipulations
- From: Lorn
- String manipulations
- Prev by Date: Re: String manipulations
- Next by Date: Re: Getting value of radiobutton trouble
- Previous by thread: Re: String manipulations
- Next by thread: Re: String manipulations
- Index(es):