我想在我的词表中搜索一些条件。你知道吗
这是我代码的一部分:
# -*- coding: utf-8 -*-
with open(r"C:\Users\Valentin\Desktop\list.txt") as f:
content = f.readlines()
content = [x.strip() for x in content]
all_words = ','.join(content)
end = all_words.endswith('e')
我的清单如下:
'cresson', 'crête', 'Créteil', 'crétin', 'creuse', 'creusé', 'creuser',...
我想设置这些条件:
我怎么能做到?你知道吗
我找到了解决办法:
你可以做一个列表:
假设不区分大小写,并且您可以访问f字符串(Python3.6):
相关问题 更多 >
编程相关推荐