<list>.append(<element>)
example.
>>> stooges = ['Moe','Larry','Curly']
>>> stooges.append('Shemp')
>>> print stooges
['Moe', 'Larry', 'Curly', 'Shemp']
<list> + <list>
example.
>>> A = [0,1]
>>> B = [2,4]
>>> C = A+B
>>> print C
[0, 1, 2, 4]
len(<list>)
example.
1)
>>> A = [0,1]
>>> len(A)
2
2)
>>> B=['a',['b',['c']]]
>>> len(B)
2
#nested된거 신경쓰지 않음, original만
'Computers > Language python' 카테고리의 다른 글
index (0) | 2012.03.14 |
---|---|
power operation (0) | 2012.03.14 |
Mutation / Aliasing (0) | 2012.03.14 |
Nested Lists (0) | 2012.03.14 |
string vs. list (0) | 2012.03.14 |