题解 | #参数解析#
参数解析
https://www.nowcoder.com/practice/668603dc307e4ef4bb07bcd0615ea677
while True: try: order=input() order=order.replace('"',',.') '''将引号换成,.''' order=order.split(',') '''用逗号分隔,同时留下.分辨''' a=[] for i in order: if "." not in i: '''非引号中命令''' tmp=i.split() for j in tmp: a.append(j) elif "." in i: if len(i)>1 and i[1]==" ":引号下一个命令 tmp=i[2:].split() for j in tmp: a.append(j) elif len(i)>1 and i[1]!=" ":引号中命令 a.append(i[1:]) print(len(a)) for i in a: print(i) except: break