[英]How do I replace the following occurrences of the first letter with a "*"?
I got stuck on this and I don't know what to do from here.我被困在这个问题上,我不知道该怎么做。
# 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 =
for example: given string = 'bubble' it should return: bu**le例如:给定 string = 'bubble' 它应该返回:bu**le
def fix_start(s):
return s[0]+ s[1:].replace(s[0],'*')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.