# -*- coding: utf-8 -*- L1 = ['Hello', 'World', 18, 'Apple', None] L2=[s.lower() if isinstance(s,str) else s for s in L1] print(L2) ['hello', 'world', 18, 'apple', None]
推测,if和for循环判断的次序并不是固定的
Sign in to make a reply
13个望辰
推测,if和for循环判断的次序并不是固定的