On 04/20/2015 07:59 AM, subhabrata.bane...@gmail.com 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 it does not open multiple files at one time. Perhaps you'd better explain better what you mean by "at one time."

But I was looking if I do not know the number of
text files I would create beforehand,

So instead of using a literal list [ "one", "two... ]
you construct one, or read it in from disk, or use sys.argv. What's the difficulty? Nothing in the code fragment you show cares how long the list is.


 so not trying xrange option
also.

No idea what "the xrange option" means.


And if in every run of the code if the name of the text files have
to created on its own.

So figure out what you're going to use for those names, and write the code to generate them.


Is there a solution for this?

For what?


--
DaveA
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to