python在字符串中引入变量的写法

以下面的代码为例,把变量checkName放到字符串“//span[text()='" + checkName + "']/../../span/a”中
具体格式就是:'" + checkName + "'

checkName = json_data['检查项名']
self.driver.find_elements_by_xpath("//span[text()='" + checkName + "']/../../span/a")[0].click()
原文地址:https://www.cnblogs.com/We612/p/12191669.html