L2 = [s.lower() for s in [x for x in L1 if isinstance(x, str)]]
先用isinstance生成一个不包含数字和None的list,然后再对这个list进行小写变化
可以一步完成:
L2 = [s.lower() for s in L1 if isinstance(s, str)]
Sign in to make a reply
诸葛大大大大大大大大大大大大仙
L2 = [s.lower() for s in [x for x in L1 if isinstance(x, str)]]
先用isinstance生成一个不包含数字和None的list,然后再对这个list进行小写变化