Python file checksum ignoring metadata

This is my code that gets the checksum of the file:

import hashlib   
print hashlib.md5(open('file.mp3','rb').read()).hexdigest()

The result is a checksum, including metadata and file contents. Is there a way to view only the contents of a file, ignoring metadata?

+4
source share
1 answer

I solved the problem of downloading the mp3hash library from https://pypi.python.org/pypi/mp3hash/ .

from mp3hash import mp3hash
print mp3hash('file.mp3')
0
source

Source: https://habr.com/ru/post/1619901/


All Articles