Dive into Python
327 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
327 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Introduction à Python en Anglais

Sujets

Informations

Publié par
Publié le 24 juin 2011
Nombre de lectures 240
Langue English
Poids de l'ouvrage 1 Mo

Extrait

..............................................................................................28 3.8. Summary ......................................................................................................................................................29 Chapter 4. The Power Of Introspection .......................................................................................................................31 4.1. Diving In ......................................................................................................................................................31 4.2. Using Optional and Named Arguments .......................................................................................................32 4.3. Usingtype, str, dir, and Other Built−In Functions ......................................................................................33 4.4. Getting Object References Withgetattr.......................................................................................................36 4.5. Filtering Lists ...............................................................................................................................................38 4.6. The Peculiar Nature ofand andor...............................................................................................................39 4.7. Usinglambda Functions ..............................................................................................................................41 4.8. Putting It All Together .................................................................................................................................43 4.9. Summary ......................................................................................................................................................45 Chapter 5. Objects and Object−Orientation ...............................................................................................................47 5.1. Diving In ......................................................................................................................................................47 5.2. Importing Modules Usingfrom module import ...........................................................................................49 5.3. Defining Classes ..........................................................................................................................................50 5.4. Instantiating Classes .....................................................................................................................................53 5.5. ExploringUserDict: A Wrapper Class ........................................................................................................54 5.6. Special Class Methods .................................................................................................................................56 5.7. Advanced Special Class Methods ................................................................................................................59 Dive Into Python i Table of Contents Chapter 5. Objects and Object−Orientation 5.8. Introducing Class Attributes ........................................................................................................................60 5.9. Private Functions .........................................................................................................................................62 5.10. Summary ....................................................................................................................................................63 Chapter 6. Exceptions and File Handling ....................................................................................................................64 6.1. Handling Exceptions ....................................................................................................................................64 6.2. Working with File Objects ...........................................................................................................................66 6.3. Iterating withfor Loops ...............................................................................................................................70 6.4. Usingsys.modules.......................................................................................................................................72 6.5. Working with Directories ............................................................................................................................74 6.6. Putting It All Together .................................................................................................................................77 6.7. Summary ......................................................................................................................................................78 Chapter 7. Regular Expressions ...................................................................................................................................81 7.1. Diving In ......................................................................................................................................................81 7.2. Case Study: Street Addresses .......................................................................................................................81 7.3. Case Roman Numerals .....................................................................................................................83 7.4. Using the{n,m} Syntax ...............................................................................................................................85 7.5. Verbose Regular Expressions ......................................................................................................................88 7.6. Case study: Parsing Phone Numbers ...........................................................................................................89 7.7. Summary ......................................................................................................................................................93 Chapter 8. HTML Processing .......................................................................................................................................94 8.1. Diving in ......................................................................................................................................................94 8.2. Introducingsgmllib.py.................................................................................................................................98 8.3. Extracting data from HTML documents ....................................................................................................100 8.4. IntroducingBaseHTMLProcessor.py........................................................................................................102 8.5. locals andglobals.......................................................................................................................................104 8.6. Dictionary−based string formatting ...........................................................................................................107 8.7. Quoting attribute values .............................................................................................................................108 8.8. Introducingdialect.py................................................................................................................................109 8.9. Putting it all together ..................................................................................................................................111 8.10. Summary ..................................................................................................................................................113 Chapter 9. XML Processing ........................................................................................................................................115 9.1. Diving in ....................................................................................................................................................115 9.2. Packages .....................................................................................................................................................121 9.3. Parsing XML ..............................................................................................................................................123 9.4. Unicode ......................................................................................................................................................125 9.5. Searching for elements ...............................................................................................................................129 9.6. Accessing element attributes ......................................................................................................................131 9.7. Segue ..........................................................................................................................................................132 Chapter 10. Scripts and Streams ................................................................................................................................133 10.1. Abstracting input sources .........................................................................................................................133 10.2. Standard input, output, and error .............................................................................................................136 10.3. Caching node lookups ..............................................................................................................................140 10.4. Finding direct children of a node ........................................................................................
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents