Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用输入功能和多项选择_Python_Selenium Webdriver_Input_Web Crawler - Fatal编程技术网

Python 使用输入功能和多项选择

Python 使用输入功能和多项选择,python,selenium-webdriver,input,web-crawler,Python,Selenium Webdriver,Input,Web Crawler,我想使用和多项选择作为输入,把我的功能和运行它。例如,我定义了一个具有url输入的函数: function('test.com/type1/type2') 我想输入类型1和类型2。例如,如果sb选择type1和type2作为xxx和yyy,我将其放在我的函数中,并作为: function('test.com/xxx/yyy') 我如何才能做到这一点?将输入放入字符串中 type1 = "xxx" type2 = "yyy" function('te

我想使用和多项选择作为输入,把我的功能和运行它。例如,我定义了一个具有url输入的函数:

function('test.com/type1/type2')

我想输入类型1和类型2。例如,如果sb选择type1和type2作为xxx和yyy,我将其放在我的函数中,并作为:

function('test.com/xxx/yyy')

我如何才能做到这一点?

将输入放入字符串中

type1 = "xxx"
type2 = "yyy"

function('test.com/' + type1 + '/' + type2)

您可以使用f字符串将输入添加到函数:

function(f'test.com/{type1}/{type2}')