F
F
First Second2020-11-07 14:00:16
Python
First Second, 2020-11-07 14:00:16

How to sequentially apply a function to a list of elements with values ​​from another list?

Hi all. The point is this. I need to insert information from the list into the inputs.

qwe = ['qwe', 'qwe', 'qwe', 'qwe', 'qwe', 'qwe'] 
forms = self.driver.find_elements_by_css_selector('input.form-textbox') # получаю инпуты


In forms, you need to sequentially send elements from the qwe list using send_keys() to each input.
I see only this way, but I know it's garbage:

i = 0
for form in forms:
    form.send_keys(qwe[i])
    i += 1


How to do this plz tell me...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-11-07
@vmolostvov

for form,key in zip(forms,qwe): 
    form.send_keys(key)

https://webdevblog.ru/use-funkcii-python-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question