Python Forum
File loop curiously skipping files - FIXED
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File loop curiously skipping files - FIXED
#11
You should use context manager to open the file (with statement). it will close the file for you at the end.
Although not related to your problem, I'm surprised, nobody mentioned you should not use built-in functions or types as names: str, dir, type
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Loop through all files in a directory? Winfried 10 413 Apr-23-2024, 07:38 PM
Last Post: FortuneCoins
  How to do "fixed size" (wrapping) math in Python? AlexanderWulf 13 1,899 Jul-19-2023, 04:13 PM
Last Post: deanhystad
  Fixed colum width for rowLabels i Matplotlib pandabay 0 428 Jun-10-2023, 03:40 PM
Last Post: pandabay
  How to loop through all excel files and sheets in folder jadelola 1 4,523 Dec-01-2022, 06:12 PM
Last Post: deanhystad
  Skipping line in text without Restarting Loop IdMineThat 4 1,499 Apr-05-2022, 04:23 AM
Last Post: deanhystad
  Encrypt and decrypt in python using own fixed key SriRajesh 3 4,879 Feb-20-2022, 01:18 PM
Last Post: dboxall123
  python seems to be skipping lines of code alansandbucket 1 4,169 Jun-22-2021, 01:18 AM
Last Post: Larz60+
  Play fixed frequency sound in python 3 jpezz 2 2,792 Feb-07-2021, 08:21 PM
Last Post: jpezz
  Referencing a fixed cell Mark17 2 2,072 Dec-17-2020, 07:14 PM
Last Post: Mark17
  Using Python to loop csv files to open them Secret 4 2,749 Sep-13-2020, 11:30 AM
Last Post: Askic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020