字符串列表:查找特定的ch

2024-06-16 11:43:04 发布

您现在位置:Python中文网/ 问答频道 /正文

假设下面的列表中只有字符串。你知道吗

appliances = ['blender', 'microwave', 'oven', 'toaster']

如何生成一个新的列表,该列表由list appliance的元素组成,其中只包含包含字母v的字符串?运行完后,新列表如下所示:

short = ['oven', 'microwave']

Tags: 字符串元素列表字母listshortblendertoaster