擅长:python、mysql、java
<p>如果你直接去天然气类型的工厂,你会有更好(更快)的结果,而不是检查每一个工厂,然后看看它是否是天然气。在</p>
<p>您可以使用以下参数获取天然气厂的列表:</p>
<pre><code>payload = {
'op': 'menu_name',
'type': '2',
'cnt': '226',
'st': '0'}
</code></pre>
<p>这将减少从46000多个请求到1384个Gas请求的搜索,并去掉<code>if power_grids == "Gas"</code>,因为我们已经知道我们已经拥有了<code>"Gas"</code></p>
<p>您的代码似乎也卡在了<code>while True</code>中。这是因为你在循环之外增加<code>i</code>,所以我修正了这个问题。在</p>
<p>最后,我没有检查你的数据,你在那里收集(即气体单位价值,气体流量,等等)。看起来有些值是空的。所以我将留给您来完成,因为这段代码至少可以帮助您克服第一个障碍。在</p>
^{pr2}$