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

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.

主站蜘蛛池模板: 峨眉山市| 满洲里市| 含山县| 清新县| 莫力| 陕西省| 龙泉市| 出国| 宜兰市| 咸阳市| 湟中县| 固始县| 黎川县| 奇台县| 渑池县| 巴楚县| 宁安市| 惠东县| 尼玛县| 新丰县| 枣阳市| 达拉特旗| 江西省| 利川市| 潜江市| 洮南市| 屯昌县| 秭归县| 平山县| 辽阳市| 彰化县| 襄城县| 泊头市| 象山县| 龙井市| 宽城| 兴城市| 隆安县| 尉犁县| 靖宇县| 克山县|