作者jeffreychen ()
看板Python
标题[问题] re.sub问题
时间Tue Apr 13 19:25:14 2010
finded2_sub = p1.sub('\g<1>subpad\g<3>', temp)
上面是我的一个程式,我想做的是把 temp的某个字串换掉,
但我的subpad是一个string变数,请问sub有支援变数吗
还是有其它的方法呢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.146.30.2
1F:→ blc:finded2_sub = p1.sub('\g<1>'+subpad+'\g<3>', temp) 04/13 19:46