擅长:python、mysql、java
<p>找到所有<code><script></code>标记,然后在其中搜索包含<code>ZPG.trackData.ecommerce</code>的标记</p>
<pre><code>ecommerce = None
for item in soup.findAll('script'):
if 'ZPG.trackData.ecommerce' in item.string:
ecommerce = item.string
break
</code></pre>