|
Server Side \ Guía de aprendizaje de Python Guía de aprendizaje de Python
Este artículo ha sido consultado en 390 ocasiones. Este es un archivo PDF para los que desean acercarse a este versátil, potente y elegante lenguaje de programación. INDICE GENERAL 1. Abriendo el apetito 1 2. Utilización del intérprete de Python 3 2.1. Llamar al intérprete . . . . . . . . . . . . . . . .. . .. . . . . . . . . . . . . . . . . . 3 2.2. El intérprete y su entorno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. Introducción informal a Python 7 3.1. Python como calculadora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2. Primeros pasos programando . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4. Más herramientas de control de flujo 19 4.1. Construcciones if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.2. Sentencias for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.3. La función range() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.4. Construcciones con break, continue y else en bucles .. . . . . . . 20 4.5. Construcciones con pass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.6. Definición de funciones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.7. Más sobre la definición de funciones . . . . . . . . . . . . . . . . . . . . . . . . 23 5. Estructuras de datos 29 5.1. Más sobre las listas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.2. La sentencia del . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.3. Tuplas y secuencias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.4. Conjuntos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.5. Diccionarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.6. Técnicas para hacer bucles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.7. Más sobre las condiciones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.8. Comparación entre secuencias y otros tipos . . . . . . . . . . . . . . . . . 37 6. Módulos 39 6.1. Más sobre los módulos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 6.2. Módulos estándar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 6.3. La función dir() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.4. Paquetes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 7. Entrada y salida 47 7.1. Formato de salida mejorado . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 7.2. Lectura y escritura de ficheros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 8. Errores y excepciones 53 8.1. Errores de sintaxis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 8.2. Excepciones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 8.3. Gestión de excepciones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 8.4. Hacer saltar excepciones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 8.5. Excepciones definidas por el usuario . . . . . . . . . . . . . . . . . 56 8.6. Definir acciones de limpieza . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . 58 9. Clases 59 9.1. Unas palabras sobre la terminología . . . . . . . . . . . . . . . . . . . . . . .. . . . 59 9.2. Ámbitos y espacios nominales en Python . . . . . . . . . . . . . . . . . . . . . . 59 9.3. Un primer vistazo a las clases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 9.4. Cajón de sastre . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 9.5. Herencia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 9.6. Variables privadas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 9.7. Remates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 9.8. Iteradores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 9.9. Generadores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 9.10. Expresiones generadoras . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . 70 10. Viaje rápido por la biblioteca estándar 71 10.1. Interfaz con el sistema operativo . . . . . . . . . . . . . . . . . . . . . . . . 71 10.2. Comodines de ficheros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 10.3. Argumentos de la línea de órdenes . . . . . . . . . . . . . . . . . . . . .. . . . . . . 72 10.4. Redirección de la salida de errores y terminación del programa . . . . . 72 10.5. Búsqueda de patrones de cadenas . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 10.6. Matemáticas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 10.7. Acceso a internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.8. Fechas y horas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.9. Compresión de datos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 10.10. Medidas de rendimiento . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . 74 10.11. Control de calidad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 10.12. Pilas incluidas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 10. Viaje rápido por la biblioteca estándar 71 10.1. Interfaz con el sistema operativo . . . . . . . . . . . . . . . . .. . . . . . . . . . 71 10.2. Comodines de ficheros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 10.3. Argumentos de la línea de órdenes . . . . . . . . . . . . . . . . . . . . . . . . . . 72 10.4. Redirección de la salida de errores y terminación del programa . . . . . 72 10.5. Búsqueda de patrones de cadenas . . . . . . . . . . . . . . .. . . . . . . . . . . 72 10.6. Matemáticas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 10.7. Acceso a internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.8. Fechas y horas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.9. Compresión de datos . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 74 10.11. Control de calidad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 10.12. Pilas incluidas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 11. Viaje rápido por la biblioteca estándar II 77 11.1. Formato de salida . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 11.2. Plantillas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 11.3. Trabajo con formatos de registros de datos binarios . . . . . . . . . . . . . . 79 11.4. Multi-hilo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 11.5. Registro de actividad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 11.6. Referencias débiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 11.7. Herramientas para trabajar con listas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 11.8. Aritmética de coma flotante decimal . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . 82 12. Y ahora, ¿qué? 85 A. Edición de entrada interactiva y sustitución de historia 87 A.1. Edición de línea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 A.2. Sustitución de historia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 A.3. Teclas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 A.4. Comentarios . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . 89 B. Aritmética de coma flotante: Consideraciones y limitaciones 91 B.1. Error de representación . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . 93 C. Historia y licencia 95 C.1. Historia del software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 C.2. Terms and conditions for accessing or otherwise using Python . . . . . . . 96 C.3. Licenses and Acknowledgements for Incorporated Software . . . . . . . . . . 98 D. Glosario 107
Última actualización: 2007-04-29 10:57:00-05 
|