私は次のものを持っています['You and i','everyone else','cat and dog','We u all']
と の横にある文字列をどうにかして特定する必要がand
ありu
ます。
たとえば、次の出力が期待されます。
君は
私
猫
犬
私達
全て
基本的に、各文は と から分割する必要がand
ありu
ます。and
との両側に 2 つのテキストをu
印刷する必要があります。
私がしたことは間違っていますが、ここに私の試みの1つがあります:
sen = [w for w in words if re.search(r'.*and*.','.*u*.', w)]
for st in sen:
print st