The study of literation in Python(20170911)

来源:互联网 发布:招网络分销方案 编辑:程序博客网 时间:2024/05/17 01:38

The study of literation in Python(20170911)

number = {1,2,3,4} # this is dict
for k in number:# the literation function in Python
print(k)

char = ‘abcd’
for key in char:
print(key)

the enumerate() function can change the list to the index-element

example

for i,value in enumerate([‘a’,’b’,’c’]):
print(i,value)# 0 a, 1 b, 2 c
for x,y in [(1,2),(2,3),(3,4)]:
print(x,y)

阅读全文
0 0
原创粉丝点击