opening more than 1 file
Skip Montanaro
skip at mojam.com
Tue Apr 20 13:53:10 EDT 1999
More information about the Python-list mailing list
Tue Apr 20 13:53:10 EDT 1999
- Previous message (by thread): Tkinter hangs in Emacs in 1.5.2 on Win32
- Next message (by thread): opening more than 1 file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
martin van nijnatten wrote:
>
> I have a variable, which can have a value in the range from 1 to 20.
>
> If the value is 7, I have to open 7 files.
>
> What could be an elegant way of doing this?
Well, how about:
files = []
for i in range(nfiles):
files.append(open("/tmp/file%03d"%i, "wb"))
then access the i-th file as files[i]?
--
Skip Montanaro | Mojam: "Uniting the World of Music"
http://www.mojam.com/
skip at mojam.com | Musi-Cal: http://www.musi-cal.com/
518-372-5583
- Previous message (by thread): Tkinter hangs in Emacs in 1.5.2 on Win32
- Next message (by thread): opening more than 1 file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list