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
  [SOLVED] Loop through directories and files one level down? Winfried 3 399 Apr-28-2024, 02:31 PM
Last Post: Gribouillis
  Loop through all files in a directory? Winfried 10 760 Apr-23-2024, 07:38 PM
Last Post: FortuneCoins
  How to do "fixed size" (wrapping) math in Python? AlexanderWulf 13 2,143 Jul-19-2023, 04:13 PM
Last Post: deanhystad
  Fixed colum width for rowLabels i Matplotlib pandabay 0 484 Jun-10-2023, 03:40 PM
Last Post: pandabay
  How to loop through all excel files and sheets in folder jadelola 1 4,730 Dec-01-2022, 06:12 PM
Last Post: deanhystad
  Skipping line in text without Restarting Loop IdMineThat 4 1,605 Apr-05-2022, 04:23 AM
Last Post: deanhystad
  Encrypt and decrypt in python using own fixed key SriRajesh 3 5,284 Feb-20-2022, 01:18 PM
Last Post: dboxall123
  python seems to be skipping lines of code alansandbucket 1 4,293 Jun-22-2021, 01:18 AM
Last Post: Larz60+
  Play fixed frequency sound in python 3 jpezz 2 2,877 Feb-07-2021, 08:21 PM
Last Post: jpezz
  Referencing a fixed cell Mark17 2 2,152 Dec-17-2020, 07:14 PM
Last Post: Mark17

Forum Jump:

User Panel Messages

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