Check If Open File Is Empty Python Functional Programming