题解 | #参数解析#
参数解析
https://www.nowcoder.com/practice/668603dc307e4ef4bb07bcd0615ea677
import re
s=input()
pattern=re.compile('\".*?\"',re.DOTALL)
matchs=re.findall(pattern,s)
matchs.reverse()
for i in range(len(matchs)):
    matchs[i]=matchs[i].replace('\"',"")
s=re.sub(pattern,"regin",s)
ls=s.split(" ")
for x in ls:
    if x=="":
        ls.remove("")
    elif x=="regin":
        ls[ls.index("regin")]=matchs.pop()
print(len(ls))
for x in ls:
    print(x)
 查看30道真题和解析
查看30道真题和解析