python-kurs-softed/beispiele/readfile1.py

13 lines
197 B
Python
Raw Normal View History

#!/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.")