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.0220 sec