Nice! It could probably benefit from passing the file as an argument:
import sys
file = sys.argv[1]
instead of call to input()You could probably do:
if len(sys.argv) > 1:
file = sys.argv[1]
else:
file = input(...)