美文网首页
2、python知识点梳-基础数据类型详解(None、布尔)

2、python知识点梳-基础数据类型详解(None、布尔)

作者: EthanQZ | 来源:发表于2017-12-15 00:52 被阅读0次

    上一篇:python知识点梳理-序

    一、python基础数据类型汇总

      python有五种标准的数据类型:

    • 数字
    • 字符串
    • 列表
    • 元组
    • 字典

      此外,还有两种特殊的类型:

    • 布尔类型

    二、空类型(NoneType)

        >>>type(None)
        <class 'NoneType'>
    

      可以用if判断是否为空:

      >>> if not f:
      ...     print 'a'
      ...
      a
    

    三、布尔类型

      布尔类型的赋值:

    bool1 = True
    bool2 = False
    

      布尔类型的赋值和操作:

    not  and  or
    

    下一篇:python知识点梳-基础数据类型详解(数字)

    相关文章

      网友评论

          本文标题:2、python知识点梳-基础数据类型详解(None、布尔)

          本文链接:https://www.haomeiwen.com/subject/putrwxtx.html