试试这个:
baseUrl = 'https://www.google.com/search?q='
browser = webdriver.Chrome(r"C:\Users\...\chromedriver.exe")
input_list = ["Bill Gates", "Elon Musk", "Warren Buffet"]
output = {}
def scrape_ceo_list(list_of_ceo):
for ceo in list_of_ceo:
browser.get(baseUrl + ceo)
// query selectors, dataframes etc as per original code
// ...
output[ceo] = df