题目:app
请实现一个函数,将一个字符串中的空格替换成“%20”。例如,当字符串为We Are Happy.则通过替换以后的字符串为We%20Are%20Happy。函数
代码:spa
1 # -*- coding:utf-8 -*- 2 class Solution: 3 # s 源字符串 4 def replaceSpace(self, s): 5 # write code here 6 return s.replace(' ','%20')