我有一个字符串:
父亲吃了一根香蕉睡在一根羽毛上
我的部分代码如下所示:
...
if word.endswith(('ther')):
print word
这打印feather,也Father
但我想修改它if condition,因此它不会将此搜索应用于句子的第一个单词。所以结果应该只打印feather。
我试过了,and但没有用:
...
if word.endswith(('ther')) and word[0].endswith(('ther')):
print word
这行不通。帮助