题解 | #替换空格#

替换空格

https://www.nowcoder.com/practice/0e26e5551f2b489b9f58bc83aa4b6c68

#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param s string字符串 
# @return string字符串
#
class Solution:
    def replaceSpace(self , s: str) -> str:
        # write code here
        newstring = ''
        for i in s:
            if i == ' ':
                i='%20'
                newstring += i
            else:
                newstring += i
        # print(newstring)
        return newstring

遍历

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-11 11:16
点赞 评论 收藏
分享
难怪不开摄像头,全是简单的性格题,比大疆友善多了
NULL10086:今早上发的测评,我这还没做呢,官网上已经显示挂了
投递大疆等公司7个岗位
点赞 评论 收藏
分享
下个早班:秒挂就是不缺人
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务