Stefan Kuzminski wrote:
>What's the most efficent way to display numbers with commas ....
>
>1,000,000
>
>given a numeric type?
>
Can't speak for the efficiency (doesn't seem very efficient with all the
type changing) but here's a simple start:
import string
def comma(num):
tmp = list(str(num))
tmp.reverse()
output = []
for i in range(0,len(tmp),3):
output += tmp[i:i+3] + [","]
output = output[:-1]
output.reverse()
return string.join(output,"")
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss