//FEATURE_COMMON @{import java.util.List;public class Test{List<String> list=new ArrayList<String>();}//@} FEATURE_COMMON//FEATURE_PLAY_STATE @{public int count(){return 20;}//@} FEATURE_PLAY_STATE//FEATURE_PLAY_MEDIA @{public int sum() {return 200;}//@} FEATURE_PLAY_MEDIA//FEATURE_COMMON @{}//@} FEATURE_COMMON通过判断Tag(//FEATURE_COMMON @{等)是否存在,取出这样一对//FEATURE_COMMON @{ .... //@} FEATURE_COMMON 中的内容
1 回答
翻阅古今
TA贡献1780条经验 获得超5个赞
>>>s=""//FEATURE_COMMOAN @{
........
........"""
>>> import re
>>> reg=re.compile(r"//FEATURE_COMMON\s+@\{(.*?)//@\}\s+FEATURE_COMMON",re.DOTALL)
>>> reg.findall(s)
添加回答
举报
0/150
提交
取消