Discuss / Python / 作业

作业

Topic source

Sayiod

#1 Created at ... [Delete] [Delete and Lock User]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Author:Sayiod


L1 = ['Hello', 'World', 18, 'Apple', None]
L2 = [i for i in L1 if isinstance(i, str)]
print(L1)
print(L2)

  • 1

Reply