如何用" *"?

时间:2015-09-23 19:08:43

标签: python string methods replace

我被困在这上面,我不知道该怎么做。

# returns a string that changes all occurrences of its first char have been changed to '*'


def fix_start(str):
    results = []
    str.startswith(str[1])
    results = 

例如:给定字符串=' bubble'它应该返回:bu ** le

1 个答案:

答案 0 :(得分:7)

def fix_start(s):
    return s[0]+ s[1:].replace(s[0],'*')