Efficient Python File Handling