Hacker News new | ask | show | jobs
by chrisheller 4160 days ago
You'll get an IndexError exception on that if there are any blank lines in the file.

Changing that to line.lstrip().startswith('#') would be an alternate approach.

1 comments

You're right but that is irrelevant, it's a somewhat contrived example anyway. It's not like I spent a lot of time trying it out.