"Jeremiah Jester" <[EMAIL PROTECTED]> wrote


I've created a function for each dictionary. However, when i print out
the dictionary I don't get all the items. Any ideas?

You should only get a very small number indeed!

       for filename in names:
               hash=os.system("md5 "+ filename)
               dict[hash] = filename

os.system only returns the exit code of the command not
the output of the command. In most cases that will be 0 to
indicate no errors.

You need to use the subprocess module (or any of the older
alternatives such as popen) to fetch the actual output of the
command from stdout and assign it to hash.

But better still use one of the python modules to do the
hashing instead of calling the OS!

I think the hashlib module's md5 function does what you want.

--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to