Oct-25-2018, 01:45 PM
(Oct-25-2018, 01:18 PM)buran Wrote: you open and close the test.txt every time you write in it. However the mode is 'w'. i.e. if the file exists it is replaced by new file. that is why you get just the last entry. use mode 'a' or you can open the file at the beginning and close it after you end iterating over the files. The drawback is you will get empty file if no file match the conditionThan you very much, it solved my problem!