宇宙探索编辑部
Topic source>>> L1=['Hello', 'World', 18, 'Apple', None]
>>> L2=[s.title() for s in L if isinstance(s,str)]
>>> L2
['Hello,World', 'Apple', 'What']
>>> L1=['Hello', 'World', 18, 'Apple', None]
>>> L2=[s.lower() for s in L if isinstance(s,str)]
>>> L2
['hello,world', 'apple', 'what']
- 1
晚安
>>> L1=['Hello', 'World', 18, 'Apple', None]
>>> L2=[s.upper() for s in L if isinstance(s,str)]
>>> L2
['HELLO,WORLD', 'APPLE', 'WHAT']