Extract string from between quotations

前端 未结 3 2038
礼貌的吻别
礼貌的吻别 2020-12-25 11:08

I want to extract information from user-inputted text. Imagine I input the following:

SetVariables \"a\" \"b\" \"c\"

How would I extract in

3条回答
  •  余生分开走
    2020-12-25 12:01

    Regular expressions are good at this:

    import re
    quoted = re.compile('"[^"]*"')
    for value in quoted.findall(userInputtedText):
        print value
    

提交回复
热议问题