Discuss / Python / 我的代码

我的代码

Topic source

tycoonBrain

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

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

print([s.lower() if isinstance(s,str)  else s for s in L ] )

我这么写的时候列表生成式只回报了这个

<generator object <genexpr> at 0x000002224230F548>

漏打了[]……


  • 1

Reply