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 2,355 Apr-28-2024, 02:31 PM
Last Post: Gribouillis
  Loop through all files in a directory? Winfried 10 4,510 Apr-23-2024, 07:38 PM
Last Post: FortuneCoins
  How to loop through all excel files and sheets in folder jadelola 1 9,395 Dec-01-2022, 06:12 PM
Last Post: deanhystad
  Skipping line in text without Restarting Loop IdMineThat 4 2,841 Apr-05-2022, 04:23 AM
Last Post: deanhystad
  python seems to be skipping lines of code alansandbucket 1 5,901 Jun-22-2021, 01:18 AM
Last Post: Larz60+
  Referencing a fixed cell Mark17 2 2,739 Dec-17-2020, 07:14 PM
Last Post: Mark17
  Using Python to loop csv files to open them Secret 4 3,781 Sep-13-2020, 11:30 AM
Last Post: Askic
  Skipping Strings Kristenl2784 0 1,958 Jul-27-2020, 06:01 PM
Last Post: Kristenl2784
  Details of attachment files in a msg file such as file names save into a python list klllmmm 2 7,089 Nov-12-2019, 05:59 AM
Last Post: klllmmm
  Loop through folder of Excel Files and extract single column fioranosnake 2 5,436 Oct-28-2019, 05:19 PM
Last Post: fioranosnake

Forum Jump:

User Panel Messages

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