¶
- 파 형 (sequence) 형 함.
- (Sequence) 형
-
- .
- ( )
-
- C 하 하. (하 )
~cpp >>> s = 'abcdef' # >>> L = [100,200,300] # 트 >>> t = ('tuple', 'object', 1, 2) # 튜플
(Sequence) 형 () ¶
- (Indexing) = k
- (Slicing) = [[ s : t ]
- 하(Concatenation) = +
- (Repeat) = *
- 트(Membership Test) = in
- = len
-- --
~cpp >>> s = 'abcdef' >>> l = [100, 200, 300]
¶
- '( 표) " (큰 표) 할 .
- 표 큰 표
- 표 큰 표 해 하 .
~cpp >>> s = 'Handsome guy Chang-Jae' >>> L = "Hwang = Babo" >>> p = ''' 하 ??? 황 . 휘 . 파. 행하 . 하, .'''
- 호 한
호 | |
\n \012 | |
\t | 탭 |
\Enter | 행 () |
\ | \ |
- (Sequence)형 .
- 할 , (immutable) 형.
(1.6 ) ¶
- 편.
환 ¶
~cpp >>> s = 'i like programing' >>> s.'''upper'''() # 환 'I LIKE PROGRAMING' >>> s.'''upper'''().'''lower'''() # 환 'i like programing' >>> s.'''capitalize'''() 'I like programing' #
¶
~cpp >>> s = 'i like programing, i like swimming' >>> s.count('like') 2 >>> s.find('like') 2 >>> s.find('my') -1 >>> s.rfind('like') 22 >>> s.index('like') 2 >>> s.index('my') Traceback (most recent call last): File "<pyshell#40>", line 1, in ? s.index('my') valueError : substring not found in string.index
합 ¶
~cpp >>> u = ' spam and ham ' >>> u .'''split'''() # ['spam','and','ham'] <--- 트 . >>> u.'''split'''('and') # 'and' . 'and' 트 . ['spam', 'ham'] >>> t = u.'''split'''() >>> ':'.'''join(t)''' # ':' 합. 할!! 'spam:and:ham' >>> print '\n'.join(t) # 합. spam and ham