题解 | #参数解析#python | 救出友军,再一举切碎

参数解析

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

s=input().strip()
loca=[]
for i in range(len(s)):
    if s[i]=='"':
        loca.append(i)
sl=list(s)
for i in range(0,len(loca)//2,2):
   for sp in range(loca[i]+1,loca[i+1]):
       if sl[sp]==' ':
           sl[sp]='*any_strange_string*'
s2= ''.join(sl)
sl2=s2.split()
print(len(sl2))
for w in range(len(sl2)):
    if '*any_strange_string*' in sl2[w]:
        sl2[w]=sl2[w].replace('*any_strange_string*',' ')
    print(sl2[w].strip('"'))
全部评论

相关推荐

05-12 17:28
已编辑
门头沟学院 硬件开发
ldf李鑫:不说公司名祝你以后天天遇到这样的公司
点赞 评论 收藏
分享
评论
点赞
1
分享

创作者周榜

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