用途
locale.format():
>>> import locale>>> locale.setlocale(locale.LC_ALL, 'German')'German_Germany.1252'>>> print(locale.format('%.2f', 32757121.33, True))32.757.121,33
locale.format()时
locale.str()等),并使其他语言环境设置不受影响:
>>> locale.setlocale(locale.LC_NUMERIC, 'English')'English_United States.1252'>>> print(locale.format('%.2f', 32757121.33, True))32,757,121.33>>> locale.setlocale(locale.LC_NUMERIC, 'German')'German_Germany.1252'>>> print(locale.format('%.2f', 32757121.33, True))32.757.121,33
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)