擅长:python、mysql、java
<p>可以将Python函数作为对象存储在列表中(因为它们是对象),并在循环中调用它们:</p>
<pre><code>actions = [chrome.find_element_by_link_text, chrome.find_element_by_class_name]
pages = ["Next Page", "pager_next"]
for action, page in zip(actions, pages):
try:
page_element = action(page)
except Exception as e:
errors_log.add(e)
</code></pre>