천단위콤마
-
숫자 천단위 마다 ,를 찍는 방법Programming/Python 2012. 3. 6. 16:04
약 1년간 nginx + django + python + sqlalchemy + jquery 를 사용하면서 정리해둔 개인 문서들을 하나씩 들쳐보는 중...... 그중 첫번째 =_= 숫자 자료형을 출력하는데 있어 천단위 마다 콤마를 찍는 방법 import locale locale.setlocale(locale.LC_ALL, '') n = 123456789 s = locale.format('%d', n, 1) print s 출력 결과 : 123,456,789