main.py104 chars4 lines
In the code above, we are using a for
loop to iterate 1000 times, creating and writing to a file with a unique file name for each iteration. The file name will be in the format file_0.txt
, file_1.txt
, etc. The with
statement ensures that the file is automatically closed after the write
operation completes.
gistlibby LogSnag