Python的字符串比较

Python的字符串比较与Java相似,也须要一个比较函数,而不能用==符号。用cmp()方法来比较两个对象,相等返回 0 ,前大于后,返回 1,小于返回 -1.java a = "abc" b = "abc" c = "aba" d = "abd" print cmp(a,b) print cmp(a,c) print cmp(a,d) //返回 0 1 -1 补充:python pytho
相关文章
相关标签/搜索