繁体   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