opening several txt files using while loop
<p>I have some txt files that their names have the following pattern: </p>

<pre><code>arc.1.txt, arc.2.txt,...,arc.100.txt,..., arc.500.txt,...,arc.838.txt
</code></pre>

<p>I know  that we can write a program using <code>for loop</code> to open the files one by one, if we now the total numbers of files. I want to know is it possible to use <code>While loop</code> without counting the number files to open them ?  </p>

<p>If you add them all to a list and then remove them one by one and set the while condition to while (name of list) > 0: then open the next file </p>

python for-loop text while-loop