How To Read Integers From A Text File In Python, I ended up with the code above which works (for my case) but certainly is far form optimal.