import os, hashlib def first () : f = open ("c:\\work\\abc.txt", "r") for line in f : print line, def calc_sum (file_name): m = hashlib.md5 () f = open (file_name, "rb") while True: d = f.read (32*1024) if not d : break m.update (d) f.close (); return m.hexdigest () def second () : p = "c:\\work" print "Adresar", p items = os.listdir (p) items.sort () for name in items : n = os.path.join (p, name) if os.path.isfile (n) : print name, calc_sum (n) second ()