Python Forum
could somebody tell me how I fix an index error?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
could somebody tell me how I fix an index error?
#4
The problem is not with the loop, but the MonthlyReport.txt file you create. You write to this file in 3 locations and you never use ; e.g. as separator. Unless there is ; in your data, which I doubt, it will throw error because split will return 1-element tuple. i.e. there is only index 0. And even if there is ; in your data, I doubt that is what you want.
Probably you want to use ; as separator, not \n.
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


Messages In This Thread
RE: could somebody tell me how I fix an index error? - by buran - Nov-29-2022, 07:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how do I fix an index error? MehHz2526 1 1,797 Jan-15-2023, 08:23 PM
Last Post: Gribouillis
  Need help fixing Index Error adesimone 1 2,265 Nov-21-2022, 07:03 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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