题解 | #参数解析#
参数解析
https://www.nowcoder.com/practice/668603dc307e4ef4bb07bcd0615ea677
思路:通过标记flag来确认是否遇到空格会进行拆分
s = input() ns = '' flag = 0 l = [] for i in s: if i == '"': flag = not flag continue if flag: ns += i elif not flag and not i.isspace(): ns += i elif not flag and i.isspace(): l.append(ns) ns = '' l.append(ns) print(len(l)) for i in l: print(i)