alansuny

导航

 

str='hello world'

str.startswith('he')

str.endswith{'y"}

str.expendtabs()

st='he \t llo world'

st.expandtabs(tabsize=10)

st.find('e')       :find first element and return index value

st.format(0) : formatting  string  assignment element for value

   usage:  for example  :st='hello kitty {'name'}'   st.format(name='alan')

    st='hello world {name} is {age}'

    st.format(name='alan',age=30)

st.format_map({})

st.index('h')

 

st.isalnum()   ;include alphabet and number ,contain alphabet and digit

st.isdecimal():     judage one string whether a decimal digit

st.isdigit()   judage element whether number integery

st.isnumeric() judage element whether numeric

'afs123'.isidentifier()  judage element whether alphabet

'aa'.islower()

'AAA'.isupper()

'  '=.isspace()

'My sister.istitle() first alphabet capital

'My siste.lower()   all alphabet lower case

'my sister.upper()  all alphabet  capital

'my sister.swapcase() twist alphabet capital or lower case

'my.sister'.ljust

'my sister'.strip() .delete  front or rear space,line break \n

st.lstrip()

st.rstrip()

st.replace('a','b')

st.rfind('t')

st.lfind('t')

st.split(‘ ’):for example   'hello kitty'.split('i')   hello k i  tty

st.rsplit('i',1)

 

st.title().   first capital 

 

posted on 2020-03-08 00:24  alansuny  阅读(170)  评论(0编辑  收藏  举报