Python 中的<>和!= 区别

来源:互联网 发布:js关键字直接量 编辑:程序博客网 时间:2024/06/10 13:42

今天在编写Python MySQL 采集脚本过程中,需要使用到“不等于”表达方式。

第一种写法:   在Python2.6以前版本:“不等于”  

if (string.atof(func.get_item(mysql_status, 'Qcache_hits')) + string.atof(      func.get_item(mysql_status, 'Com_select'))) <> 0:
第二种写法:在Python3.0以后版本:“不等于”
if (string.atof(func.get_item(mysql_status, 'Qcache_hits')) + string.atof(      func.get_item(mysql_status, 'Com_select'))) != 0:

原创粉丝点击