作者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