# -*- coding:utf-8 -*- class Solution: # s 源字符串 def replaceSpace(self, s): # write code here n=len(s) for i in range(n): if s[i]==‘ ‘: s=s.replace(s[i],‘%20‘) return s while 1: try: ss=Solution() s=raw_input() print(ss.replaceSpace(s)) except: break
原文:https://www.cnblogs.com/yangyang1989/p/11402574.html