新浦京娱乐场官网locale module accesses a database of

2019-06-19 20:03栏目:技术创新
TAG:

#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)

版权声明:本文由新浦京娱乐站_新浦京娱乐场官网_新浦京娱乐发布于技术创新,转载请注明出处:新浦京娱乐场官网locale module accesses a database of