By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,547 Members | 1,435 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,547 IT Pros & Developers. It's quick & easy.

utterly new and trying to do difficult things with files

P: 1
Hi,

I'm new to python, as in I read the first 5 chapters of 'dive into python' new.

I'm trying to use the levenshtein algorithm to do some edit distance comparisions. However rather than comparing strings I want to compare files (oo-er). My idea is to get the binary or hexadecimal output of a file (perhaps using xxd) and then save that to a variable. Then use the algorithm to 'compare' how similar the files are.

I've worked out how to open a file using open(filename,"r"), this however returns the ascii value of data in the file which isn't much use to me.

My query is twofold. Firstly do you think I am crazy and doing things completely inefficiently?
Secondly how can I retreive the binary / hex stream of a binary file in python?

Many thanks

niT
Jul 13 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.