Switched from a for loop to a while loop to read file lines and it finally clicked for me
I spent about 2 hours last Saturday trying to read a 500 line text file in Python and kept getting an index error with my for loop. My buddy told me to try a while loop with a readline() call instead, and it worked on the first run. The big thing was I could check for an empty line at the top of the loop and just stop, instead of guessing how many lines were there. I know it's small stuff but I actually yelled at my screen when it printed all 500 lines clean. Has anyone else had a loop type switch just make a problem way easier to see?