题目链接:https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/
难度:简单
描述:
请实现一个函数,把字符串 s 中的每个空格替换成”%20”。
题解
class Solution:def replaceSpace(self, s: str) -> str:ret = []for c in s:if c == " ":ret.append("%20")else:ret.append(c)return "".join(ret)
