Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.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 - Fatal编程技术网

在点后添加空格的Python正则表达式

在点后添加空格的Python正则表达式,python,regex,Python,Regex,如何使用re在Python中编写正则表达式来查找模式: 点“.”后跟任何字符[a-zA-Z](不是空格或数字) 然后在点和字符之间加一个空格 i、 e 提前感谢,, Zvire.sub(r'\.([a-zA-Z]),r'.\1',oldstr)试试看 re.sub(r"\.([a-zA-Z])", ". \\1", "Thanks.Bob") re.sub(“(?@Chris我知道。我使用它是因为他在问题中已经分配了它。我现在修复了它。ARG!变量名中的大小写混合!ARG!几乎没有什么可抱怨的

如何使用
re
在Python中编写正则表达式来查找模式:

点“.”后跟任何字符[a-zA-Z](不是空格或数字)

然后在点和字符之间加一个空格

i、 e

提前感谢,, Zvi

re.sub(r'\.([a-zA-Z]),r'.\1',oldstr)
试试看

re.sub(r"\.([a-zA-Z])", ". \\1", "Thanks.Bob")

re.sub(“(?@Chris我知道。我使用它是因为他在问题中已经分配了它。我现在修复了它。ARG!变量名中的大小写混合!ARG!几乎没有什么可抱怨的了!;-)
re.sub(r"\.([a-zA-Z])", ". \\1", "Thanks.Bob")
re.sub('(?<=\.)(?=[a-zA-Z])', ' ', str)