我有一个这样的示例代码:
from selenium import webdriver
from multiprocessing import Pool
url = ['https://www.google.com','https://www.facebook.com']
driver = webdriver.Firefox()
def browser(x):
driver.get(url[x])
if __name__ == "__main__":
pool = Pool(2)
pool.map(browser,url)
收到错误:
Traceback (most recent call last):
File "test.py", line 12, in <module>
pool.map(browser,url)
File "C:\Python27\lib\multiprocessing\pool.py", line 251, in map
return self.map_async(func, iterable, chunksize).get()
File "C:\Python27\lib\multiprocessing\pool.py", line 567, in get
raise self._value
TypeError: list indices must be integers, not str
我做错了吗?