视图.py
combineKeyword =""myKeyword", "Auto", "st3-throttling-cdb", "functional""
template_desc2 = "@Test(groups = { "Code-planned", "Code-not automated", "Code-st3reporter" }
import re
re.sub(r' @Test\(groups\s*=\s*\{([^\}]+)',combineKeyword,template_desc2)
这里我想替换“Code planned”、“Code not automated”、“Code-st3reporter”这些关键字,并将combineKeyword
放在那里
您的示例有语法错误,我假设字符串被包装在单引号中
''
,而内部字符串类似于"Code-planned"
如果要替换所有字符串(无论是否以代码开头):
相关问题 更多 >
编程相关推荐