<tfoot id='PjDsj'></tfoot>
      • <bdo id='PjDsj'></bdo><ul id='PjDsj'></ul>

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

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

        Python 将 0 评估为 False

        Python evaluates 0 as False(Python 将 0 评估为 False)
        <tfoot id='j65oL'></tfoot>

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

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

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

                <i id='j65oL'><tr id='j65oL'><dt id='j65oL'><q id='j65oL'><span id='j65oL'><b id='j65oL'><form id='j65oL'><ins id='j65oL'></ins><ul id='j65oL'></ul><sub id='j65oL'></sub></form><legend id='j65oL'></legend><bdo id='j65oL'><pre id='j65oL'><center id='j65oL'></center></pre></bdo></b><th id='j65oL'></th></span></q></dt></tr></i><div id='j65oL'><tfoot id='j65oL'></tfoot><dl id='j65oL'><fieldset id='j65oL'></fieldset></dl></div>
                    <tbody id='j65oL'></tbody>
                  本文介绍了Python 将 0 评估为 False的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 Python 控制台中:

                  In the Python console:

                  >>> a = 0
                  >>> if a:
                  ...   print "L"
                  ... 
                  >>> a = 1
                  >>> if a:
                  ...   print "L"
                  ... 
                  L
                  >>> a = 2
                  >>> if a:
                  ...   print "L"
                  ... 
                  L
                  

                  为什么会这样?

                  推荐答案

                  在Python中,boolint的子类,False值为 0;即使值没有在 if 语句(它们是)中隐式转换为 boolFalse == 0 也是 true.

                  In Python, bool is a subclass of int, and False has the value 0; even if values weren't implicitly cast to bool in an if statement (which they are), False == 0 is true.

                  这篇关于Python 将 0 评估为 False的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
                  Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
                  Is there a way of group by month in Pandas starting at specific day number?( pandas 有从特定日期开始的按月分组的方式吗?)
                  Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
                  Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
                  Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)

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

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

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

                              <tbody id='ryl6G'></tbody>