python 找到列表中满足条件的元素

a = [1,2,3,4,5,6,7,8,9]
b = [str(x) for x in a if x%2==1]
s = ''.join(b)

=>'13579'

 

posted @ 2020-12-10 17:14  乱炖er  阅读(1295)  评论(0编辑  收藏  举报