文字列内の単一のアルファベット文字の出現ごとにすべてのインデックスを検索したいと考えています。単一の char html コードをキャッチしたくありません。
これが私のコードです:
import re
s = "fish oil B stack peanut c <b>"
words = re.finditer('\S+', s)
has_alpha = re.compile(??????).search
for word in words:
if has_alpha(word.group()):
print (word.start())
望ましい出力:
9
24