![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
starry_nights
生之宇宙,归之殊途,星芒万里,瞬时毫厘。
展开
-
python中[:-1]与[::-1]
list = [a,b,c,d,e] list[:-1] = [a,b,c,b],从第一个到最后一个,但不包括最后一个。 list[::-1]=[e,d,c,b,a],即是将其反转。原创 2020-02-03 19:56:04 · 250 阅读 · 0 评论 -
python的filter,素数的筛选
#筛选素数 def_odd_iter():#生成器 n=1 whileTrue: n=n+2 yieldn def_not_divisible(n):#筛选器 returnlambdax:x%n>0 defprimes():#生成器 yield2 it...原创 2020-02-03 19:41:11 · 320 阅读 · 0 评论