擅长:python、mysql、java
<p>如果不需要为列表使用名称,可以使用<code>*args</code>:</p>
<pre><code>def WorkDetails(link, *args):
if args[0] == ... # Same as if AllcurrValFound_bse == ...
...
# Call the function:
WorkDetails(link, AllcurrValFound_bse, AllyearlyHLFound_bse, AlldaysHLFound_bse, AllvolumeFound_bse, AllprevCloseFound_bse, AllchangePercentFound_bse, AllmarketCapFound_bs)
</code></pre>
<p>或者你可以用字典</p>
<pre><code>def WorkDetails(link, dict_of_lists):
if dict_of_lists["AllcurrValFound_bse"] == ...
...
# Call the function
myLists = {
"AllcurrValFound_bse": AllcurrValFound_bse,
"AllyearlyHLFound_bse": AllyearlyHLFound_bse,
...,
...
}
WorkDetails(link, myLists)
</code></pre>