Minor improvements

Hi, Andy. This pull request includes some minor changes:

1. Uses the `os` module to handle path separators, in order to improve portability (it wasn't working on Linux).
2. Iterates directly over the file instance instead of making a single `read()` and then splitting on lines. Note the use of `rsplit()` on each line to remove any trailing blank spaces. This way, any "\r" or "\n" at the end will be removed, which also increases portability.

Feel free to simply ignore the pull request or include just part of its ideas, in case you don't totally agree.