简体   繁体   中英

how to use an item from a dictionary in a function and then loop the function until it goes through the whole dictionary in python

browser.find_element_by_xpath("/html/body/div[4]/div/div/div[2]/div[1]/div/div[2]/input").send_keys(acountstodm)

The acountstodm is a dictionary with a bunch of accounts that I need my program to run through. I cant type them all in at the same time or else it would send it in a big group and I need to send each thing individually. I have a function that runs this line of code and a bunch of other lines which looks like this - def dm(): I need this code to run until all the accounts in the dictionary have been run through.

for key, value in acountstodm.items()

this is how you access each key and value individually. Just put your function inside the loop

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM