簡體   English   中英

如何用“*”替換以下出現的第一個字母?

[英]How do I replace the following occurrences of the first letter with a "*"?

我被困在這個問題上,我不知道該怎么做。

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

例如:給定 string = 'bubble' 它應該返回:bu**le

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM