Section 21.2. Strategies for Parsing Text in Python

21.2. Strategies for Parsing Text in Python

In the grand scheme of things, there are a variety of ways to handle text processing in Python:

  • Built-in string object expressions

  • String object method calls

  • Regular expression matching

  • Parser-generator integrations

  • Handcoded and generated parsers

  • Running Python code with eval and exec built-ins

For simpler tasks, Python's built-in string object is often all we really need. Python strings can be indexed, concatenated, sliced, and processed with both string method calls and built-in functions. Our emphasis in this chapter, though, is on higher-level tools and techniques for analyzing textual information. Let's briefly explore each of the other approaches with representative examples.

Programming Python
Programming Python
ISBN: 0596009259
EAN: 2147483647
Year: 2004
Pages: 270
Authors: Mark Lutz © 2008-2017.
If you may any questions please contact us: