我想取字符串0.71331, 52.25378并返回0.71331,52.25378- 即只需查找数字,逗号,空格和数字,并删除空格.
这是我目前的代码:
coords = '0.71331, 52.25378'
coord_re = re.sub("(\d), (\d)", "\1,\2", coords)
print coord_re
Run Code Online (Sandbox Code Playgroud)
但这给了我0.7133,2.25378.我究竟做错了什么?