====== 文字列検索(find, index) ====== ===== find, index ===== find('文字列'[, 開始位置[, 終了位置]]) index('文字列'[, 開始位置[, 終了位置]]) a = 'abcdefabcdef' a.find('cg') -1 a.index('cg') Traceback (most recent call last): File "", line 1, in ValueError: substring not found a.find('cd') 2 a.index('cd') 2 a.find('cd', 6) 8 a.index('cd', 6) 8 a.find('cg', 6) -1 a.index('cg', 6) Traceback (most recent call last): File "", line 1, in ValueError: substring not found ===== 参考文献 ===== [[https://docs.python.org/ja/3/library/stdtypes.html|組み込み型 — Python 3.7.3 ドキュメント]]\\