Christopher Arndt 16ab66c6a8 Add examples for reading files
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
2024-05-06 07:44:35 +02:00

13 lines
197 B
Python

#!/usr/bin/env python
import sys
filename = sys.argv[1]
with open(filename, "rb") as fileobj:
data = fileobj.read()
num_bytes = len(data)
print(f"The file contents are {num_bytes} long.")