Skip to main content

🟢 剑指 Offer 05. 替换空格

LeetCode 提示

题目难度 简单

原题链接 🔗 leetcode

题解 1.py#

class Solution:    def replaceSpace(self, s: str) -> str:        ss = ''        for c in s:            if c == ' ':                ss += '%20'            else:                ss += c        return ss