User Tools

Site Tools


python:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
python:index [2019/06/04 08:26] rlunaropython:index [2020/10/08 09:02] rlunaro
Line 1: Line 1:
 ====== Python ====== ====== Python ======
  
 +===== md5sum in python =====
  
-Notas para un curso de python. 
  
-===== Sesión 1: toma de contacto =====+<code python>
  
-**Tarea pendiente**+
 +# md5sum.py 
 +#
  
-Identificar un IDE para python. +import sys 
 +import hashlib  
 + 
 + 
 +if __name__ == '__main__':  
 +  
 + for filename in sys.argv[1:] :  
 + with open(filename, "rb" ) as file :  
 + md5 = hashlib.md5()  
 + chunksize = 65536 # 64k'
 + content = file.read( chunksize ) 
 + while content != b'' :  
 + md5.update(content) 
 + content = file.read( chunksize ) 
 + 
 + md5.digest() 
 + if len(sys.argv[1:]) > 1 :  
 + print( f"{filename}: ", end =''
 + print(md5.hexdigest())  
 + 
 +</code> 
 + 
 + 
 +<code> 
 + 
 +@echo off 
 +rem md5sum.cmd 
 + 
 + 
 +python "%~dp0md5sum.py" %* 
 + 
 +</code>
  
-**Objetivos** 
  
-Tener un IDE instalado y capaz de ejecutar un "hola mundo" 
  
  
python/index.txt · Last modified: 2022/12/02 22:02 by 127.0.0.1