官术网_书友最值得收藏!

Operations and expressions

There are a number of operations that are common to all data types. For example, all data types, and generally all objects, can be tested for a truth value in some way. The following are values that Python considers False:

  • The None type
  • False
  • An integer, float, or complex zero
  • An empty sequence or mapping
  • An instance of a user-defined class that defines a __len__() or __bool__() method that returns zero or False

All other values are considered True.

主站蜘蛛池模板: 行唐县| 永川市| 苍南县| 杨浦区| 乌审旗| 武川县| 剑川县| 平远县| 永春县| 香港 | 治多县| 漯河市| 阳高县| 湖南省| 格尔木市| 呼伦贝尔市| 多伦县| 桦南县| 建始县| 西充县| 河北省| 宜昌市| 柏乡县| 武川县| 乌审旗| 尚志市| 金山区| 手机| 金湖县| 中牟县| 泰安市| 阿拉善右旗| 德化县| 乌兰浩特市| 正镶白旗| 长春市| 黑河市| 工布江达县| 贺兰县| 黄陵县| 潮州市|