题解 | #参数解析#

参数解析

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

command = input()
lst = command.split('"')    #索引为奇数的元素在“”内
res = []
for i in range(len(lst)):
    if i % 2 == 0:
        res.extend(lst[i].split())
    else:
        res.append(lst[i])
print(len(res))
for i in res:
    print(i)

全部评论

相关推荐

MinatoWu:是这样的,说的太对了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务