python:index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
python:index [2019/06/04 06:39] – rlunaro | python:index [2022/12/02 21:02] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
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 | ||
- | ==== Objetivos ==== | ||
- | Tener un IDE instalado y capaz de ejecutar un "hola mundo" | + | if __name__ == ' |
+ | |||
+ | for filename in sys.argv[1: | ||
+ | with open(filename, | ||
+ | md5 = hashlib.md5() | ||
+ | chunksize = 65536 # 64k' | ||
+ | content = file.read( chunksize ) | ||
+ | while content != b'' | ||
+ | md5.update(content) | ||
+ | content = file.read( chunksize ) | ||
- | ==== Forma de llevarlo a cabo ==== | + | md5.digest() |
+ | if len(sys.argv[1: | ||
+ | print( f" | ||
+ | print(md5.hexdigest()) | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | < | ||
+ | |||
+ | @echo off | ||
+ | rem md5sum.cmd | ||
+ | |||
+ | |||
+ | python " | ||
+ | |||
+ | </ | ||
- | Primero instalaremos un entorno de desarrollo de una forma guiada: comenzaremos bajandonos el | ||
- | interprete de python y un editor de textos: con ellos haremos un "hola mundo" muy sencillito | ||
- | que nos permita ver cómo se trabaja en python de una forma rudimentaria. | ||
python/index.1559630344.txt.gz · Last modified: 2022/12/02 21:02 (external edit)