2020-1-7

>>> string='  python    '
>>> string
'  python    '
>>> string.rstrip()
'  python'

>>> string.rstrip()
'  python'
>>> string.strip()
'python'
>>> string.lstrip()
'python'

 

>>> x = ' Albert Einstein once said, " A person who never made a mistake never tried anything new."'
>>> print(x)
 Albert Einstein once said, " A person who never made a mistake never tried anything new."

 

>>> x= 'albert einstein'
>>> x.title()
'Albert Einstein'

 

.reverse()

.sort()

.sorted()

.sort(reverse=True)

posted @ 2020-01-07 14:19  flyme2moon  阅读(110)  评论(0)    收藏  举报