久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網
      最全最豐富的資訊網站

      python中count函數的用法

      python中count函數的用法

      python中count函數的用法

      Python count()方法

      描述

      Python count() 方法用于統(tǒng)計字符串里某個字符出現的次數。可選參數為在字符串搜索的開始與結束位置。

      count()方法語法:

      str.count(sub, start= 0,end=len(string))

      參數

      sub — 搜索的子字符串

      start — 字符串開始搜索的位置。默認為第一個字符,第一個字符索引值為0。

      end — 字符串中結束搜索的位置。字符中第一個字符的索引為 0。默認為字符串的最后一個位置。

      返回值

      該方法返回子字符串在字符串中出現的次數。

      以下實例展示了count()方法的實例:

      實例(Python 2.0+)

      #!/usr/bin/python   str = "this is string example....wow!!!";   sub = "i"; print "str.count(sub, 4, 40) : ", str.count(sub, 4, 40) sub = "wow"; print "str.count(sub) : ", str.count(sub)

      以上實例輸出結果如下:

      str.count(sub, 4, 40) :  2 str.count(sub) :  1

      推薦學習:Python視頻教程

      贊(0)
      分享到: 更多 (0)
      網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號