string generator
Gustavo Cordova
gcordova at hebmex.com
Mon Jun 3 13:57:51 EDT 2002
>
> I like to create a list of file automatical based on series.
> For example
> user input the number of file say 5. So i want to generate the file
> according to this range , this mean the generated files could be
> filename1
> filename2
> filename3
> filename4
> filename5
> I using the for loop like that
>
> for file in range(5):
> lis = [file]
> string.join('filename',lis[1:])
> how can it didn't work. I am confusing how to do it.
>
Yeah, but where do you wanna put your results?
You could also:
FNs = ["filename%d" % i for i in range(5)]
or also you could:
FNs = map(lambda i:"filename%d" % i, range(5))
or many other variations thereof.
Good luck!
-gustavo
More information about the Python-list
mailing list