[s.lower() for s in L1 if not isinstance(s,(int,float))]
Traceback (most recent call last):
File "<pyshell#176>", line 1, in <module>
[s.lower() for s in L1 if not isinstance(s,(int,float))]
File "<pyshell#176>", line 1, in <listcomp>
[s.lower() for s in L1 if not isinstance(s,(int,float))]
AttributeError: 'NoneType' object has no attribute 'lower'
走庄子路线
[s.lower() for s in L1 if not isinstance(s,(int,float))] Traceback (most recent call last): File "<pyshell#176>", line 1, in <module> [s.lower() for s in L1 if not isinstance(s,(int,float))] File "<pyshell#176>", line 1, in <listcomp> [s.lower() for s in L1 if not isinstance(s,(int,float))] AttributeError: 'NoneType' object has no attribute 'lower'
为什么这样不行?