python 文字列メソッド (str method)
>>> 'hoge'.capitalize() 'Hoge' >>> 'HoGe'.swapcase() 'hOgE' >>> 'hoge MOGE'.title() 'Hoge Moge' >>> 'hoge moge'.translate(None, 'og') 'he me' >>> 'hoge'.upper() 'HOGE' >>> 'hoge'.zfill(10) '000000hoge' >>>','.join('hoge') 'h,o,g,e' >>> ' hoge '.strip() 'hoge' >>> ' hoge '.lstrip() 'hoge ' >>> ' hoge '.rstrip() ' hoge' >>> 'hoge'.partition('o') ('h', 'o', 'ge') >>> 'hoge moge hoge moge'.replace('ge','mu',3) 'homu momu homu moge' >>> 'hoge'.center(10) ' hoge '
コメント
コメントを投稿