>>> x = 1
>>> not x
False
>>> x = [1]
>>> not x
False
>>> x = 0
>>> not x
True
>>> x = [0]     # You don't want to fall in this one.
>>> not x
False
 
在python中 None, False, 空字符串"", 0, 空列表[], 空字典{}, 空元组()都相当于False ,即:
not None == not False == not '' == not 0 == not [] == not {} == not ()
 if a != None:
其意思是a!=none,则执行:后面的语句

随机推荐

  1. itchat 爬了爬自己的微信通讯录

    参考 一件有趣的事: 爬了爬自己的微信朋友 忘记从谁那里看到的了,俺也来试试 首先在annconda prompt里面安装了itchat包 pip install itchat 目前对python这里 ...

  2. Android Q 使用通知栏消息

    String myChannelId = "iot"; String myChannelName = "告警通知服务"; NotificationManager ...

  3. CSS常用小技巧

    1.隐藏overflow滚动条 ::-webkit-scrollbar { display:none } 2.单行文字两端对齐(例:输入框前的label) // 若考虑兼容,文字间要有空格 { tex ...

  4. solr 对于 关键字的特殊处理

    public static String transformMetachar(String input){      StringBuffer sb = new StringBuffer();     ...

  5. badge徽章、挂件模版

    markdown语法 Gitee卡片 Gitee挂件 Github挂件 Gitee卡片 [![gqzdev/ForFuture Group](https://gitee.com/zhong96/sho ...

  6. QT安装和vs2015使用

    下载Qt5.7.0安装包(qt-windows-opensource)与Qt插件(Visual Studio Add-in) QT软件下载地址: http://download.qt.io/archi ...

  7. mybatis(五):源码分析 - config文件加载流程

    详细的可以参考https://blog.csdn.net/weixin_33850890/article/details/88112849

  8. 本地项目如何上传到github

      首先登录官网注册用户(此处不多介绍),然后需要登录github创建仓库 https://github.com/ 然后取一个自己喜欢的名字(这里我的名字是webclock),点击Create rep ...

  9. EF中的实体关系

    导航属性的理解: 指数据库的表所对应的实体类,除了要有每个字段所对应的属性之外,还应该有一个与之有关联的表的属性,一对一的关系就是关联表的类型,一对多的关系就是关联表的类型的ICollection的泛 ...

  10. VNCserver 安装 及 oracle过程总结

    一.安装桌面系统 1.命令   yum grouplist ---列举系统中以组安装的包(组安装的包会包括很多,组安装一下就就可以安装很多附在的包.) 2.  yum groupinstall &qu ...