EOF analysis in Python