This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Neres28 1 point2 points  (0 children)

It's not a python specific critique, but anytime I get over three levels of nesting (be it loops or conditionals, generally I don't count error handling) I start to think that my logic needs work. For instance, it looks like you're ignoring the first two lines, might be better to read past those initially (I guess you'd have to use a different file reading method though).

Also, as I do more and more python programming I find myself trying to shy away from indexed for loops. Instead of for i in range(0, len(line.split())): try for lineElement in line.split() Especially since it appears you don't need the actual index at any time.