betway必威-betway必威官方网站
做最好的网站

locale module accesses a database of culture specific data f

#locale module accesses a database of culture specific data formats. The 
#grouping 
#attribute of locale's format function provides a direct way of formatting numbers 
#with group separators:

import locale
locale.setlocale(locale.LC_ALL, 'English_United States.1252')

conv = locale.localeconv()          # get a mapping of conventions
x = 1234567.8

locale.format('%d', x, grouping=True)

locale.format('%s%.*f', (conv['currency_symbol'],conv['frac_digits'], x), grouping=True)

本文由betway必威发布于编程开发,转载请注明出处:locale module accesses a database of culture specific data f

TAG标签: betway必威
Ctrl+D 将本页面保存为书签,全面了解最新资讯,方便快捷。