Python Forum
"for loop" not indexing correctly?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"for loop" not indexing correctly?
#4
(Jan-24-2020, 02:31 PM)DeaD_EyE Wrote: Instead of looking up the whole data in memory, you could use an iterative solution: Line by line
they process the file line by line, but as @ThiefOfTime explained, they were consuming 2 lines at a time (one in the loop, next with readline()), but processing just the second one.
the comment about the regex itself is valid though
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
"for loop" not indexing correctly? - by melblanc - Jan-24-2020, 01:03 PM
RE: "for loop" not indexing correctly? - by buran - Jan-24-2020, 02:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Matrix indexing and initialization in " for in" loop QuintenR 2 1,896 Dec-23-2020, 05:59 PM
Last Post: QuintenR
  Nested loop indexing Morte 4 4,025 Aug-04-2020, 07:24 AM
Last Post: Morte
  How to change 0 based indexing to 1 based indexing in python..?? Ruthra 2 4,555 Jan-22-2020, 05:13 PM
Last Post: Ruthra
  Why doesn't my loop work correctly? (problem with a break statement) steckinreinhart619 2 3,258 Jun-11-2019, 10:02 AM
Last Post: steckinreinhart619

Forum Jump:

User Panel Messages

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