<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 輕松python文本專題-字符串開頭或者結尾匹配 場景: 字符串開頭或者結尾匹配,一般是使用在匹配文件類型或者url 一般使用startwith或者endwith ~~~ >>>?a='http://blog.csdn.net/raylee2007'?? >>>?a.startswith?('http')?? True?? ~~~ 注意:這兩個方法里面的參數可以是str,也可以是元組,但是不可以是列表和字典 ~~~ >>>?a='http://blog.csdn.net/raylee2007'?? >>>?a.startswith?(('http','ftp'))?? True?? ~~~ 如果是列表或者字典,則報錯 ~~~ >>>?a='http://blog.csdn.net/raylee2007'?? >>>?a.startswith?(['http','ftp'])?? Traceback?(most?recent?call?last):?? ??File?"",?line?1,?in??? ????a.startswith?(['http','ftp'])?? TypeError:?startswith?first?arg?must?be?str?or?a?tuple?of?str,?not?list?? >>>??? ~~~ 其實,除了上面的方法, 也可以使用切片來實現,只不過代碼看上去沒那么好看而已 ~~~ >>>?a='http://blog.csdn.net/raylee2007'?? >>>?a[0:4]=='http'?? True?? >>>??? ~~~ 當然,我們也可以用正則表達式來做,但是理解上面就稍微難度有點。 ~~~ >>>?import?re?? >>>?url?=?'http://www.python.org'?? >>>?re.match('http:|https:|ftp:',?url)?? 0,?5),?match='http:'>?? >>>?help(re.match?)?? Help?on?function?match?in?module?re:?? ?? match(pattern,?string,?flags=0)?? ????Try?to?apply?the?pattern?at?the?start?of?the?string,?returning?? ????a?match?object,?or?None?if?no?match?was?found.?? ?? >>>??? ~~~ 就說到這里,謝謝大家
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看