If the length of the line is actually 0, this will throw an ```IndexError```.  Safest to rewrite as:
```python
if not line or line.startswith('#')
```