初学Python之字符串操作

字符串.replace()

phone_number='158-8888-8888'

hide_number=phone_number.replace(phone_number[:9],'*'*9)

字符串.format()

____a word she can get what she ____ for.

A.With B.came

'{}a word she can get what she{}for.'.formate('with','came')

'{0}a word she can get what she{1}for.'.formate('with','came')

'{prepostion}a word she can get what she{verb}for.'.formate(prepostion='with',vreb='came')

原文地址:https://www.cnblogs.com/flyxue/p/6040043.html