import sys import hashlib def get_sha1(path): with open(path) as f: return hashlib.sha1(f.read().encode('utf-8')).hexdigest() print('{}'.format(get_sha1(sys.argv[1])))