replace 的用法
replace(被替代的字符串,替代部分)
>>> hiding_number = phone_number.replace(phone_number[:9],'*'*9)
>>> print (hiding_number)
*********0006
format的用法
{} 里面可以有变量名,数组编号,或者直接按顺序。
>>> print ('{} a word she can get what she {} for.'.format('With','came'))
With a word she can get what she came for.
网友评论