替换空格 牛客网 剑指Offer
- 题目描述
- 请实现一个函数,将一个字符串中的每个空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。
class Solution:
#run:25ms memory:5624k
def replaceSpace(self, s):
s = s.replace(" ","%20")
return s
替换空格 牛客网 剑指Offer
class Solution:
#run:25ms memory:5624k
def replaceSpace(self, s):
s = s.replace(" ","%20")
return s