This topic created in 3929 days ago, the information mentioned may be changed or developed.
如何将字符串"way, to ,explore , ( 11,11abc)" 替换成 "way,to,explore , (11.11abc)" 呢??
就是把仅仅只"把括号内的逗号 ,给替换成句号",其他不变
Supplement 1 · Feb 17, 2016
解决了,我是用的笨点的方法.直接将括号'(' 前后分开,然后把'('后面的那字符串去 str.replace(',','.')
下面几位的我也去试试看,谢谢了
Supplement 2 · Feb 17, 2016
好奇怪,,,为何我自己发的帖子里没有提醒....
2 replies • 2016-02-17 20:16:22 +08:00
 |
|
import re re.compile(r'(\(.*),(.*\))').sub(r'\1.\2','way, to ,explore , ( 11,11abc)')
|
 |
|
(.+\(.+), => $1. 写完觉得这个正则很美, 2333
|