题解 | #参数解析#
参数解析
https://www.nowcoder.com/practice/668603dc307e4ef4bb07bcd0615ea677
s = input() #1 如果s中不存在引号,则直接用空格分 ls = [] if '"' not in s: ss = s.split() for i in ss: ls.append(i) #2 如果s中有引号,则先用引号分再用空格分 else: ss = s.split('"') for i in range(len(ss)): if i%2 == 1: ls.append(ss[i]) else: sss = ss[i].split() for j in sss: ls.append(j) print(len(ls)) for i in ls: print(i)