Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/280.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.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_Regex Negation - Fatal编程技术网

哪种python正则表达式最好只排除一对花括号之间的逗号的单个实例?

哪种python正则表达式最好只排除一对花括号之间的逗号的单个实例?,python,regex,regex-negation,Python,Regex,Regex Negation,如果行包含多个逗号,我希望返回它 例如,在下面的几行中,我想返回除{,}之外的所有行 {,,,} {abskdjf} {,} 你就不能在这一点上完全匹配吗?例如,在Python中,如果文本是一个名为text的变量,那么re.sub(r“{,},”,text)您能提供到目前为止尝试过的内容吗?

如果行包含多个逗号,我希望返回它

例如,在下面的几行中,我想返回除
{,}
之外的所有行

{,,,}
{abskdjf}
{,}

你就不能在这一点上完全匹配吗?例如,在Python中,如果文本是一个名为text的变量,那么
re.sub(r“{,},”,text)

您能提供到目前为止尝试过的内容吗?