L1=['Hello','World',18,'Apple',None] L2=[s.lower for s in L1 if isinstance(s,str)] print(L2)
结果 [<built-in method lower of str object at 0x00BD5A00>,
<built-in method lower of str object at 0x00BD5A80>,
<built-in method lower of str object at 0x00C1D280>] 这是什么呀= =
仔细对照教程的例子:
[s.lower() for s in L]
Sign in to make a reply
McG后生
结果 [<built-in method lower of str object at 0x00BD5A00>,
<built-in method lower of str object at 0x00BD5A80>,
<built-in method lower of str object at 0x00C1D280>] 这是什么呀= =