Opening Multiple files at one time

subhabrata.banerji at subhabrata.banerji at
Wed Apr 22 18:13:26 CEST 2015

On Monday, April 20, 2015 at 5:30:15 PM UTC+5:30, subhabrat... at wrote:
> Dear Group,
> I am trying to open multiple files at one time. 
> I am trying to do it as,
>  for item in  [ "one", "two", "three" ]:
>        f = open (item + "world.txt", "w")
>        f.close()
> This is fine. But I was looking if I do not know the number of
> text files I would create beforehand, so not trying xrange option
> also. 
> And if in every run of the code if the name of the text files have
> to created on its own. 
> Is there a solution for this? 
> If anybody may please suggest. 
> Regards,
> Subhabrata Banerjee.

Surely, this problem is more or less fixed. But I experiment with all answers everytime to get better angles.

More information about the Python-list mailing list