Discuss / Python / 交作业

交作业

Topic source

方糖米菲

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

L = ['Hello', 'World', 18, 'Apple', None] L2 = [] for n in L: if isinstance(n,str) == True: L2.append(n) print(L2)

方糖米菲

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

L1 = ['Hello', 'World', 18, 'Apple', None] L2 = [] for n in L1: if isinstance(n,str) == True: L2.append(n) L2 = [n.lower() for n in L2] print(L2)


  • 1

Reply