题解 | #参数解析#

参数解析

http://www.nowcoder.com/practice/668603dc307e4ef4bb07bcd0615ea677

while True:
    try:
        s = input()
        flag, temp, args = False, '', []
        for c in s + ' ':
            if c == '"':
                # 如果遇到引号,若标志位flag被打开,则关闭;否则将其开启
                flag = False if flag else True
                continue
            if c != ' ':
                temp += c
            else:
                if flag:
                    temp += c
                else:
                    args.append(temp)
                    temp = ''
        print(len(args))
        for a in args:
            print(a)
    except:
        break
全部评论
大佬厉害
点赞 回复 分享
发布于 2022-06-03 22:16

相关推荐

点赞 评论 收藏
分享
nus2201602...:兄弟,你这个简历撕了丢了吧,就是一坨,去找几个项目,理解项目流程,看几遍就是你的了,看看八股就去干了,多看看牛客里别人发出来的简历,对着写,你这写的啥啊,纯一坨
点赞 评论 收藏
分享
评论
1
3
分享

创作者周榜

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