【python3 tips】文字列の中に特定の文字があるか調べる 投稿日: 2021-04-032021-04-04 投稿者: karasumaru inを使う single = 'a' str = 'abcde' if single in str: print("YES") else: print("NO") # 含まれているのでYESになる 参考Pythonで文字列を検索(〜を含むか判定、位置取得、カウント)https://note.nkmk.me/python-str-search/ 0