python:index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
python:index [2014/12/24 13:31] – rlunaro | python:index [2022/12/02 21:02] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Python ====== | ====== Python ====== | ||
+ | |||
+ | ===== md5sum in python ===== | ||
+ | |||
+ | |||
+ | <code python> | ||
+ | |||
+ | # | ||
+ | # md5sum.py | ||
+ | # | ||
+ | |||
+ | import sys | ||
+ | import hashlib | ||
+ | |||
+ | |||
+ | if __name__ == ' | ||
+ | |||
+ | for filename in sys.argv[1: | ||
+ | with open(filename, | ||
+ | md5 = hashlib.md5() | ||
+ | chunksize = 65536 # 64k's | ||
+ | content = file.read( chunksize ) | ||
+ | while content != b'' | ||
+ | md5.update(content) | ||
+ | content = file.read( chunksize ) | ||
+ | |||
+ | md5.digest() | ||
+ | if len(sys.argv[1: | ||
+ | print( f" | ||
+ | print(md5.hexdigest()) | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | < | ||
+ | |||
+ | @echo off | ||
+ | rem md5sum.cmd | ||
+ | |||
+ | |||
+ | python " | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
- | Because not only of Java can live the man.... | ||
- | * [[installIde|Install an ide in python]] | ||
python/index.1419427896.txt.gz · Last modified: 2022/12/02 21:02 (external edit)