데이터 길이 : len(data)
Python Expression |
Results |
Description |
---|---|---|
len([1, 2, 3]) | 3 | Length |
[1, 2, 3] + [4, 5, 6] | [1, 2, 3, 4, 5, 6] | Concatenation |
['Hi!'] * 4 | ['Hi!', 'Hi!', 'Hi!', 'Hi!'] | Repetition |
3 in [1, 2, 3] | True | Membership |
for x in [1, 2, 3]: print x, | 1 2 3 | Iteration |
----------------------------------------------------------------------------------------------
array 구성 방식
Assuming following input −
L = ['spam', 'Spam', 'SPAM!']
Python Expression | Results | Description |
---|---|---|
L[2] | 'SPAM!' | Offsets start at zero |
L[-2] | 'Spam' | Negative: count from the right |
L[1:] | ['Spam', 'SPAM!'] | Slicing fetches sections |
----------------------------------------------------------------------------------------------
Reference
주소 복사 못함
'언어 > ㄴPython' 카테고리의 다른 글
[python] generating random array (0) | 2016.01.21 |
---|---|
[python] what is assert (0) | 2016.01.21 |
[python] what is difference between numpy's 'array' and 'asarray' (0) | 2016.01.19 |
[python] 'from X import name' vs 'import X.name' (0) | 2016.01.17 |
[python] understanding for 'from, import' (0) | 2016.01.17 |