How do I create a new text file after every loop in a while loop?
<p>I have a piece of text which I want to write in different text files, so I'm using a while loop to create a new txt file after every loop. However I don't know how to create a new text file AFTER every loop has been completed. For the text, I have a variable outside the loop, so the text is not an issue. I just don't know how to create new multiple files, without rewriting the existing txt file. Can someone please help?</p>

<p>just generate a different filename every time you open the file for writing that would do.
Or best would be not to create multiple files. Just write into one file and create (no_of_copies-1) symlinks with  different names. This would be efficient. </p>

python while-loop createfile