|
Size: 1824
Comment:
|
Size: 1806
Comment: 删除对PageComment2组件的引用
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 65: | Line 65: |
| [[PageComment2]] |
::-- JinQing [DateTime(2008-04-16T02:13:30Z)] BRBR
21.2. Strategies for Parsing Text in Python BRBR
In the grand scheme of things, there are a variety of ways to handle text processing in Python: BRBR
- 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
- 用内置的eval和exec运行Python代码
BRBR 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. BRBR
对于较简单的任务,我们往往只需Python内置的字符串对象。 Python的字符串可以进行索引、拼接、切片,并且可用字符串方法和内置函数进行处理。然而,本章的重点是,分析文本信息的高级工具和技术。让我们以代表性的例子,简要地探索各种方法。 BRBR
