Discuss / Python / 作业7

作业7

Topic source

孤o赦免你

#1 Created at ... [Delete] [Delete and Lock User]

L1 = ['Hello', 'World', 18, 'Apple', None]

L2 = [x.lower() if isinstance(x,str) else x for x in L1 ]

print(L2)

#打印结果:

['hello', 'world', 18, 'apple', None]


  • 1

Reply