如何在 Python 中按数组顺序随机获取数组

How to get Array one by one Randomly in array order in Python

我已经自动将数字数组中的数字一一发送到文本框,如下所示,而数字是从数组中获取的,同时如何随机获取邮件ID来自电子邮件数组?

import time

numbers = [2589001,2589002,2589003,2589004,2589005,2589006,2589007,2589008,2589009,2589010] 
email = ["mail1@gmail.com","mail2@gmail.com","mail3@gmail.com","mail4@gmail.com","mail5@gmail.com"] 

def oo() :
    for idx in email :
    
        email_from_list = email[idx%len(email)]
        
#I want to put those email function code here and need to pass this def oo()

c = 0
def vs () :
    for idx, nm in enumerate(numbers) :
        
        #Number Input
        WebDriverWait(browser, 2500).until(EC.presence_of_element_located((By.NAME, "Number"))).send_keys(nw)
        time.sleep(1)
        
        WebDriverWait(browser, 2500).until(EC.presence_of_element_located((By.NAME, "Number"))).send_keys(oo()) #<---- here need to call
        time.sleep(1)
        #I need code here to get email id one by one randomly from array   <--- Fix you wording. You don't actually want them one by one randomly

w = 0     
while w < 50 :
    vs ()
    w += 1

我已经阅读了您的评论,您所描述的并不是您在原文中所要求的post/question。您想要的是遍历相同的电子邮件列表(不想 select 随机电子邮件)。

import time

numbers = [2589001,2589002,2589003,2589004,2589005,2589006,2589007,2589008,2589009,2589010] 
email = ["mail1@gmail.com","mail2@gmail.com","mail3@gmail.com","mail4@gmail.com","mail5@gmail.com"] 

c = 0
def vs () :
    for idx, nm in enumerate(numbers) :
        
        #Number Input
        WebDriverWait(browser, 2500).until(EC.presence_of_element_located((By.NAME, "Number"))).send_keys(nw)
        time.sleep(1)
        
        #I need code here to get email id one by one randomly from array   <--- Fix you wording. You don't actually want them one by one randomly
        email_from_list = email[idx%len(email)]
        


w = 0     
while w < 50 :
    vs ()
    w += 1