Python3中替代Python2中cmp()函數的新函數(gt,ge,eq,le,lt)

Python3中已經不能使用cmp()函數了,被以下五個函數替代:python import operator #首先要導入運算符模塊 operator.gt(1,2) #意思是greater than(大於) operator.ge(1,2) #意思是greater and equal(大於等於) operator.eq(1,2) #意思是equal(等
相關文章
相關標籤/搜索