题解 | #替换空格#
替换空格
https://www.nowcoder.com/practice/0e26e5551f2b489b9f58bc83aa4b6c68
class Solution: def replaceSpace(self , s: str) -> str: # write code here mystr=[] for c in s: if c==' ': mystr.append('%20') else: mystr.append(c) #注意.join的用法 return ''.join(mystr)