这题目用Python不用动脑子,直接截取字符串用replace函数就行
class Solution:
def replaceSpaces(self, S: str, length: int) -> str:
return S[:length].replace(" ", "%20")
这题目用Python不用动脑子,直接截取字符串用replace函数就行
class Solution:
def replaceSpaces(self, S: str, length: int) -> str:
return S[:length].replace(" ", "%20")