Fork me on GitHub

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

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

change = json_data['亚瑟']
self.driver.find_elements_by_xpath("//span[text()='" + change+ "']/../../span/a")[0].click()
posted @ 2020-01-14 14:01  路痴队长  阅读(1000)  评论(0编辑  收藏  举报