文書の表示以前のリビジョンバックリンク文書の先頭へ この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。 ====== 文字列検索(find, index) ====== ===== find, index ===== <code python> find('文字列'[, 開始位置[, 終了位置]]) index('文字列'[, 開始位置[, 終了位置]]) </code> <code python> a = 'abcdefabcdef' a.find('cg') -1 a.index('cg') Traceback (most recent call last): File "<stdin>", line 1, in <module> 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 "<stdin>", line 1, in <module> ValueError: substring not found </code> ===== 参考文献 ===== [[https://docs.python.org/ja/3/library/stdtypes.html|組み込み型 — Python 3.7.3 ドキュメント]]\\ python/find_index.txt 最終更新: 2019/08/19 06:52by ともやん