#!/bin/env python3 #coding=utf-8 L = ['Hello', 'World', 18, 'Apple',None] #print ( "L =" ,L ) L2 = [i.lower() for i in L if isinstance(i,str)] #因为字符已经是True 所以可以免去 一个boolean判断? print (L2)
Sign in to make a reply
Statby