2015-09-23 37 views
-4

我被困在這,我不知道該從這裏做什麼。如何用「*」代替下列第一個字母的出現?

# 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 = 

例如:給定的字符串= '氣泡',它應該返回:BU **樂

回答

7
def fix_start(s): 
    return s[0]+ s[1:].replace(s[0],'*') 
相關問題