python:index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
python:index [2019/06/12 22:58] – rlunaro | python:index [2019/06/17 15:59] – rlunaro | ||
---|---|---|---|
Line 204: | Line 204: | ||
**Tuplas** | **Tuplas** | ||
+ | < | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | # instalación | ||
+ | |||
+ | |||
+ | pip install virtualenv | ||
+ | |||
+ | |||
+ | # creación de una copia del entorno python para mi proyecto: | ||
+ | |||
+ | virtualenv python-env | ||
+ | |||
+ | donde " | ||
+ | |||
+ | |||
+ | # arrancar el entorno virtual | ||
+ | |||
+ | Este comando nos será de utilidad para cuando queramos usar el " | ||
+ | este entorno para instalar más librerías: | ||
+ | |||
+ | python-env\Scripts\activate | ||
+ | |||
+ | Es muy conveniente anotar las librerías instaladas en un fichero para que | ||
+ | posteriores instalaciones sean perfectamente reproducibles: | ||
+ | cuentas, disponer de un entorno virtual permite hacer estas cosas | ||
+ | con más facilidad. | ||
+ | |||
+ | |||
+ | # parar el entorno virtual | ||
+ | |||
+ | python-env\Scripts\deactivate | ||
+ | |||
+ | |||
+ | # ejecutar el intérprete de python sobre el entorno virtual | ||
+ | |||
+ | sencillamente configuraremos como intérprete nuevo en la configuración de eclipse el | ||
+ | nuevo entorno creado, y en la configuración del proyecto apuntaremos a dicho script | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | import os | ||
+ | import zipfile | ||
+ | from zipfile import ZIP_DEFLATED | ||
+ | |||
+ | |||
+ | |||
+ | for root, dirs, files in os.walk(" | ||
+ | print(" | ||
+ | print(" | ||
+ | print(" | ||
+ | |||
+ | |||
+ | with zipfile.PyZipFile(" | ||
+ | my_zip_file.compression = ZIP_DEFLATED | ||
+ | my_zip_file.write( " | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | </ | ||
===== Sesión N: plantilla ===== | ===== Sesión N: plantilla ===== |
python/index.txt · Last modified: 2022/12/02 22:02 by 127.0.0.1