Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python中,如何找到字符串中表达式后面的子字符串?_Python_Regex_Python 3.x - Fatal编程技术网

在Python中,如何找到字符串中表达式后面的子字符串?

在Python中,如何找到字符串中表达式后面的子字符串?,python,regex,python-3.x,Python,Regex,Python 3.x,我目前有一个大字符串big_string,其中包含以下元素: ..."string1":"74f07sdfafeijsfeijfsl","string2":"XRewejffeew","zero_data":{},"string3":"c2d8f4380025",... 我想提取“string2”之后的字符串,这样我就可以有一个变量: substring='XRewejffeew' 有没有办法用re.findall()?findall()实现这一点(?如果可能的话,请改为解析JSON,在询问之

我目前有一个大字符串
big_string
,其中包含以下元素:

..."string1":"74f07sdfafeijsfeijfsl","string2":"XRewejffeew","zero_data":{},"string3":"c2d8f4380025",...
我想提取
“string2”
之后的字符串,这样我就可以有一个变量:

substring='XRewejffeew'


有没有办法用
re.findall()

findall()实现这一点(?如果可能的话,请改为解析JSON,在询问之前您是否尝试过这样做?在提出任何建议之前,我想知道很多数据要求和兴趣点。值中是否允许逗号?
是否所有内容都是基本的
对?是否允许引号插入
s或
s?可能重复
findall('(?<="string2":")\w+', big_string) # Result: 'XRewejffeew'