2024-04-26 10:50:56 发布
网友
在Python中,如何从第二个位置带有“I”的列表中查找单词
example_list = ['one','two','three','four','five','six','seven']
我想找到所有在第二个位置有“I”的单词
the output should look like this: ['five','six']
可能吗
使用indexing检查条件Strings也可以像list一样在字符串s = 'python',s[0] is 'p', s[1] is 'y'中索引
indexing
Strings
list
s = 'python'
s[0] is 'p', s[1] is 'y'
[i for i in example_list if i[1] == 'i']
['five', 'six']
使用
indexing
检查条件Strings
也可以像list
一样在字符串s = 'python'
,s[0] is 'p', s[1] is 'y'
中索引相关问题 更多 >
编程相关推荐