endswith
count
format
部分文字列が出現する回数を返します。
str.count(sub, start?, end?)
下記の値を入力するとサンプルに即時反映されます。
print
text = "banana" print(text.count("a")) # 3 print(text.count("an")) # 2