python:find_index

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
python:find_index [2019/05/18 02:23] – 外部編集 非ログインユーザーpython:find_index [2019/08/19 06:52] (現在) ともやん
行 1: 行 1:
-====== 文字列検索 ======+====== 文字列検索(find, index) ====== 
 + 
 +===== find, index ===== 
 +<code python> 
 +find('文字列'[, 開始位置[, 終了位置]]) 
 +index('文字列'[, 開始位置[, 終了位置]]) 
 +</code> 
 <code python> <code python>
 a =  'abcdefabcdef' a =  'abcdefabcdef'
行 6: 行 13:
 -1 -1
 a.index('cg') a.index('cg')
-ValueError+Traceback (most recent call last): 
 +  File "<stdin>", line 1, in <module> 
 +ValueError: substring not found
  
 a.find('cd') a.find('cd')
行 21: 行 30:
 -1 -1
 a.index('cg', 6) a.index('cg', 6)
-ValueError+Traceback (most recent call last): 
 +  File "<stdin>", line 1, in <module> 
 +ValueError: substring not found
 </code> </code>
 +
 +===== 参考文献 =====
 +[[https://docs.python.org/ja/3/library/stdtypes.html|組み込み型 — Python 3.7.3 ドキュメント]]\\
 +
  • python/find_index.1558113795.txt.gz
  • 最終更新: 2019/05/18 02:23
  • by 非ログインユーザー