PHP
·
发表于 5年以前
·
阅读量:8410
from random import randint
data = [randint(-10,10) for _ in range(10)]
data_after=[x for x in data if x > 0]
from random import randint
data = [randint(-10,10) for _ in range(10)]
data_after=list(filter(lambda x:x > 0, data))