<br><br><div class="gmail_quote">On Jan 8, 2008 7:22 AM, Hrvoje Niksic <<a href="mailto:hniksic@xemacs.org">hniksic@xemacs.org</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Fredrik Lundh <<a href="mailto:fredrik@pythonware.com">fredrik@pythonware.com</a>> writes:<br><div class="Ih2E3d"><br>> BJ Swope wrote:<br>><br>>>     the code looks ok.  please define "not working".
<br>>><br></div><div class="Ih2E3d">>> Yep, defining "not working" is always helpful! :)<br>>><br>>> I want to have all 3 files open at the same time.  I will write to<br>>> each of the files later in my script but just the last file is open
<br>>> for writing.<br>><br></div><div class="Ih2E3d">> to keep more than one file open, you need more than one variable, or a<br>> variable that can hold more than one object.<br>><br>> if the number of files may vary, put the file objects in a list.
<br><br></div>Or in a dict:<br><br>open_files = {}<br>for fn in ['messages', 'recipients', 'viruses']:<br>    open_files[fn] = open(getfilename(fn), 'w')<br><br># open_files['messages'] is the open file 'messages' etc.
<br><font color="#888888">--<br></font><div><div></div><div class="Wj3C7c"><a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br></div></div>
</blockquote></div><br>I decided that I was just trying to be "too smooth by 1/2" so I fell back to ...<br><br><br clear="all">messages = open(os.path.join(host_path,'messages.txt'), 'wb')<br>deliveries = open(
os.path.join(host_path,'deliveries.txt'), 'wb')<br>actions = open(os.path.join(host_path,'actions.txt'), 'wb')<br>parts = open(os.path.join(host_path,'parts.txt'), 'wb')<br>
recipients = open(os.path.join(host_path,'recipients.txt'), 'wb')<br>viruses = open(os.path.join(host_path,'viruses.txt'), 'wb')<br>esp_scores = open(os.path.join(host_path,'esp_scores.txt'), 'wb')
<br><br><br>Thank you to everybody who answered.<br>