Skip to content

Commit 9d1e6ac

Browse files
author
kangxiaoyu
committed
test
1 parent f3a65f5 commit 9d1e6ac

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

2017-04-20/list_execise/iteration.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# -*- coding:utf-8 -*-
1+
G# -*- coding:utf-8 -*-
22

33
d = {'a':1,'b':2,'c':3}
44

@@ -50,3 +50,18 @@
5050
print [s.lower() for s in L ]
5151

5252
print isinstance(1,str) #判断是否式字符串。
53+
54+
55+
嵌套的列表可以拆开
56+
p = ['asp','php']
57+
s = ['python', 'java',p,'scheme']
58+
59+
p = ['asp','php']
60+
>>> s = ['python', 'java', p, 'scheme']
61+
>>> p[1]
62+
'php'
63+
64+
tuple
65+
另一种有序列表叫元组,: tuple和list非常类似但是tuple一旦初始化就不能修改比如同样的列出同学的名字
66+
67+
classmate = ('Michael','bob','Tracy')

doc/使用元组.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tuple
2+
另一种有序列表叫元组:tuple. tuple和list非常类似,但是tuple一旦初始化就不呢修改,
3+
比如同样是列出同学的名字。
4+
5+
classmates = ('Michael', 'Bob','Tracy')

0 commit comments

Comments
 (0)