[Tutor] multiple file output

tpc at csua.berkeley.edu tpc at csua.berkeley.edu
Tue Sep 9 10:16:29 EDT 2003


hi Jimmy, you would probably want to use a for statement, so if you have
a list of files stored in filelist:

<code>
for file in filelist:
        out = open(file, 'w')
        out.write(str)
        out.close()
</code>

On Tue, 9 Sep 2003, Jimmy verma wrote:

> Hello tutor,
>
> Thanks to everyone for their suggestions. Now i want to open the file with
> names which are created dynamically.
>
>
>      out = open('f[i].txt', 'w')
>      out.write(str)
>      out.close()
>
> something like this where f[i] should be coming from some list f
>
>
> Your valuable suggestions are welcomed.
>
> Regards,
> J+
>
> _________________________________________________________________
> On the move? Need to access your mails?
> http://server1.msn.co.in/sp03/mobilesms/index.asp Hotmail is now on your
> mobile!
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>




More information about the Tutor mailing list