passing contents from multiple lists generated in different functions to a file
<p>I have 3 functions which generate three different lists. I am trying to generate a mel script which is a text file which will write the values taken from these three lists. All three lists have same number of values. All the values in these lists are animation data and therefore they have to be passed in a mel script to drive an animation in Maya. All these lists values are floating point numbers.</p>

<pre><code>func1() :
    generates tlist

func2() :
    generates list1

func3() :
    generates list2  

def mel_script() :
  """ Generating the mel script with the animation information """
  with open("mel.txt", "w") as melFile :
      melFile.write(setKeyframe "blend_shape.lip_round";
                    setKeyframe "blend_shape.jaw_open";

                    currentTime 0 ;
                    setAttr "blend_shape.lip_round" 0;
                    setAttr "blend_shape.jaw_open" 0;
                    setKeyframe -breakdown 0 -hierarchy none -controlPoints 0 -shape 0 {"blend_shape"}; 

                    currentTime (first value of tlist) ;
                    setAttr "blend_shape.lip_round" (first value of list1);
                    setAttr "blend_shape.jaw_open" (first value of list2);
                    setKeyframe -breakdown 0 -hierarchy none -controlPoints 0 -shape 0 {"blend_shape"};

                    currentTime (second value of tlist) ;
                    setAttr "blend_shape.lip_round" (second value of list1);
                    setAttr "blend_shape.jaw_open" (second value of list2);
                    setKeyframe -breakdown 0 -hierarchy none -controlPoints 0 -shape 0 {"blend_shape"};                       
                   ........
                   ........
</code></pre>

<p>The first 6 lines in the file are default. The text in the mel script should continue up until the last values from each list. How can I achieve this? Thank you. </p>
