代码如下:
def strcmp(str1,str2):
i = 0
while i outcome = cmp(str1[i],str2[i])
if outcome:
print outcome
return outcome
i +=1
return cmp(len(str1),len(str2))
str1='dfdcd'
str2='dfdc'
print strcmp(str1,str2)
print cmp(str1,str2)
查看更多关于使用python实现strcmp函数功能示例的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did90414