U E D R , A S I H C RSS

2학기파이선스터디/문자열


  • (sequence) .
    - (Sequence)

    1. .
    2. 각 객 가능( )

  • C로 면 배다. (다는 기는 다르다는 기)


-- --
~cpp 
>>> s = 'abcdef'                   # 문
>>> L = [100,200,300]              # 리
>>> t = ('tuple', 'object', 1, 2)  # 

(Sequence) (명령)


  1. (Indexing) = k

  2. (Slicing) = [[ s : t ]

  3. 기(Concatenation) = +

  4. 반복(Repeat) = *

  5. (Membership Test) = in

  6. 보 = 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

  • 나머드는


  • 는 방법로는

    1. # 는 방법( C // )

    2. (doucmentation string) 는 방법

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:13
Processing time 0.0139 sec