<legend id='Nb37d'><style id='Nb37d'><dir id='Nb37d'><q id='Nb37d'></q></dir></style></legend>

    <small id='Nb37d'></small><noframes id='Nb37d'>

    • <bdo id='Nb37d'></bdo><ul id='Nb37d'></ul>

    1. <tfoot id='Nb37d'></tfoot>
    2. <i id='Nb37d'><tr id='Nb37d'><dt id='Nb37d'><q id='Nb37d'><span id='Nb37d'><b id='Nb37d'><form id='Nb37d'><ins id='Nb37d'></ins><ul id='Nb37d'></ul><sub id='Nb37d'></sub></form><legend id='Nb37d'></legend><bdo id='Nb37d'><pre id='Nb37d'><center id='Nb37d'></center></pre></bdo></b><th id='Nb37d'></th></span></q></dt></tr></i><div id='Nb37d'><tfoot id='Nb37d'></tfoot><dl id='Nb37d'><fieldset id='Nb37d'></fieldset></dl></div>

      如何打印带有数千个分隔符的浮点数?

      时间:2023-10-09
        <bdo id='ZDOlm'></bdo><ul id='ZDOlm'></ul>
        <i id='ZDOlm'><tr id='ZDOlm'><dt id='ZDOlm'><q id='ZDOlm'><span id='ZDOlm'><b id='ZDOlm'><form id='ZDOlm'><ins id='ZDOlm'></ins><ul id='ZDOlm'></ul><sub id='ZDOlm'></sub></form><legend id='ZDOlm'></legend><bdo id='ZDOlm'><pre id='ZDOlm'><center id='ZDOlm'></center></pre></bdo></b><th id='ZDOlm'></th></span></q></dt></tr></i><div id='ZDOlm'><tfoot id='ZDOlm'></tfoot><dl id='ZDOlm'><fieldset id='ZDOlm'></fieldset></dl></div>

        <small id='ZDOlm'></small><noframes id='ZDOlm'>

        <legend id='ZDOlm'><style id='ZDOlm'><dir id='ZDOlm'><q id='ZDOlm'></q></dir></style></legend>

            1. <tfoot id='ZDOlm'></tfoot>

                  <tbody id='ZDOlm'></tbody>
                本文介绍了如何打印带有数千个分隔符的浮点数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                如何格式化十进制数,以便 32757121.33 显示为 32.757.121,33?

                How can I format a decimal number so that 32757121.33 will display as 32.757.121,33?

                推荐答案

                使用 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() 等时)并保留其他语言环境设置不受影响:

                You can restrict the locale changes to the display of numeric values (when using locale.format(), locale.str() etc.) and leave other locale settings unaffected:

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

                这篇关于如何打印带有数千个分隔符的浮点数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:ValueError:Python2.6.6 格式中的零长度字段名称 下一篇:扭曲的文档字符串中这些格式的含义是什么?

                相关文章

                最新文章

                  <bdo id='gLoeG'></bdo><ul id='gLoeG'></ul>

              • <legend id='gLoeG'><style id='gLoeG'><dir id='gLoeG'><q id='gLoeG'></q></dir></style></legend>

                  <small id='gLoeG'></small><noframes id='gLoeG'>

                1. <tfoot id='gLoeG'></tfoot>

                    <i id='gLoeG'><tr id='gLoeG'><dt id='gLoeG'><q id='gLoeG'><span id='gLoeG'><b id='gLoeG'><form id='gLoeG'><ins id='gLoeG'></ins><ul id='gLoeG'></ul><sub id='gLoeG'></sub></form><legend id='gLoeG'></legend><bdo id='gLoeG'><pre id='gLoeG'><center id='gLoeG'></center></pre></bdo></b><th id='gLoeG'></th></span></q></dt></tr></i><div id='gLoeG'><tfoot id='gLoeG'></tfoot><dl id='gLoeG'><fieldset id='gLoeG'></fieldset></dl></div>