1
0

【Python】特定の文字列と文字列の間を抽出する方法

Last updated at Posted at 2024-02-29

◆問題
特定の文字列と文字列の間を抽出する方法が分からなかった。

◆対処法
スライスを使用すればできた。

slice.py
txt = '僕は、「情弱」だ。'
result = txt[txt.find('') + 1:txt.find('')]
# 今回一気にやっていますが、分けてやってもよい。

print(result)

# 実行結果
情弱
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0