美文网首页
字符串操作

字符串操作

作者: 三千万星辰 | 来源:发表于2016-08-11 18:04 被阅读15次

    1.判断一个字符串的开头和结尾

    s1 = 'https://github.com/solaris-meng/yushan2/blob/master/baiduapi/views.py'
    print(s1.startswith('http://'))
    print(s1.endswith('py'))
    mengan:cookbook mengan$ python strstart.py 
    False
    True
    

    相关文章

      网友评论

          本文标题:字符串操作

          本文链接:https://www.haomeiwen.com/subject/hhjssttx.html