>> import -6ren">
gpt4 book ai didi

python - 从引号之间提取字符串

转载 作者:IT老高 更新时间:2023-10-28 20:23:30 24 4
gpt4 key购买 nike

我想从用户输入的文本中提取信息。想象一下我输入以下内容:

SetVariables "a" "b" "c"

如何在第一组引用之间提取信息?那么第二个呢?那么第三个呢?

最佳答案

>>> import re
>>> re.findall('"([^"]*)"', 'SetVariables "a" "b" "c" ')
['a', 'b', 'c']

关于python - 从引号之间提取字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2076343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com