源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

使用python实现strcmp函数功能示例

  • 时间:2022-02-24 07:20 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:使用python实现strcmp函数功能示例
实现这个功能我相信大家一定明白他的意思了,很简单了,下面的代码大家参考使用吧
[u]复制代码[/u] 代码如下:
def strcmp(str1,str2):         i = 0         while i<len(str1) and i<len(str2):                 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)
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部