编程语言
首页 > 编程语言> > python笔记4

python笔记4

作者:互联网

序列函数

x = [3, 9, 6]
sum(x, 155) # x+155
x = [3, 9, 6]
reversed(x)
<list_reverseiterator at 0x1807e626048>
list(reversed(x))
[6, 9, 3]
x = [3, 9, 6]
enumerate(x)
<enumerate at 0x1807e58c5a0>
list(enumerate(x))
[(0, 3), (1, 9), (2, 6)]
a = [1, 2 , 3, 4]
b = [4, 5]
zip(a, b), list(zip(a, b))
(<zip at 0x1807e617448>, [(1, 4), (2, 5)])

注意:

标签:155,zip,python,reversed,list,笔记,enumerate,序列
来源: https://blog.csdn.net/qq_45019494/article/details/113774651