#!/usr/bin/env python3 with open('/root/.hermes/wizard-outputs/spark/code_stats.py', 'rb') as f: content = f.read() print('File length:', len(content)) print('Last byte:', content[-1], '(10 = newline, 32 = space)') print('Ends with newline:', content[-1] == 10) print('Line count method 1:', content.count(b'\n')) print('Line count method 2:', len(content.split(b'\n')))