0
我想从一个字符串在Python 3下删除一个角色是我的代码:试图从一个字符串在Python删除一个3字
#Function that removes a character from a string
def removeChar(character, string):
new_string = string.replace(character, "")
print(removeChar("e", "Hello World"))
不过,这一方案的输出只是None
。我的代码有什么问题?
,因为你没有返回'new_string'值... –
加上'在函数的最后返回new_string' – rassar