<p><code>lower_lip_under_upper_teeth_bezier</code>是一个<strong>函数</strong>。错误信息清楚地告诉它,没有办法绕过它。在</p>
<p>您可能认为<code>lower_lip_under_upper_teeth_bezier</code>是iterable,但事实并非如此。在</p>
<p>现在,我只是猜测,但我相信你想做的是:</p>
<pre><code>def mel_script(lip_var):
'''The mel script generated for the input speech with the chosen energy level'''
with open("mel.txt", "w") as melFile :
melFile.write('setKeyframe "BS_stickyLips_SL_recept.head_geo_stickyLips_wire";'
'setKeyframe "BS_stickyLips_baseSL_recept.head_geo";'
'setKeyframe "BS_stickyLips_wireSL_recept.head_geo";'
'setKeyframe "blend_shape.lip_round";'
'setKeyframe "blend_shape.jaw_open";'
'setKeyframe "blend_shape.lips_spread";'
'setKeyframe "blend_shape.lips_part";'
'setKeyframe "blend_shape.lower_lip_under_upper_teeth";')
for p in lip_var: # Check this out!!!
melFile.write('setAttr "blend_shape.jaw_open" %f ;' % p )
</code></pre>
<hr/>
<p><strong>编辑(见注释)</strong>:我认为这里对python的工作原理有一些基本的误解。。。在python中(就像在大多数编程语言中一样!)当你声明一个函数时,你要声明它的名字和它期望的参数。在</p>
<p>如果您试图将5个列表传递给<code>mel_script</code>,那么当您声明<code>mel_script</code>时,您应该这样说:</p>
^{pr2}$
<p>然后,在调用<code>mel_script</code>时,需要将这些列表传递给它。如果这样的列表是由函数生成的(比如<code>f1</code>,<code>f2</code>,<code>f3</code>…)。您可以在一行中完成所有操作:</p>
<pre><code>mel_script(f1(), f2(), f3(), f4(), f5())
</code></pre>
<p>否则,您必须将列表存储在临时变量中并将其传递给<code>mel_scirpt</code>:</p>
<pre><code>tmp1 = f1()
tmp2 = f2()
tmp3 = f3()
tmp4 = f4()
tmp5 = f5()
mel_script(tmp1, tmp2, tmp3, tmp4, tmp5)
</code></pre>
<p>在上面的例子中,注意<code>f1()</code>有圆括号,表示您正在调用</strong>名为<code>f1</code>的函数。如果您忽略这些,那么您将传递<em>函数本身,而不是其结果</em>。在</p>
<p>实际上,有更聪明的方法来实现这一点(比如传递可变数量的参数,或者使用闭包,但是从你的问题中我知道你还没有(现在!)精通python,所以现在最好还是坚持这个方法!:)</p>
<p>啊!在</p>