python 字符串比较

cmp方法比较两个对象,并根据结果返回一个整数。cmp(x,y)若是X< Y,返回值是负数 若是X>Y 返回的值为正数。html

sStr1 = 'strch'
sStr2 = 'strchr'
print cmp( sStr1 , sStr2) ##-1
想要了解更多字符串相关的信息,能够看下 python字符串
相关文章
相关标签/搜索