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