Text Processing in Python by David Mertz

Text Processing in Python by David Mertz

Author:David Mertz [Mertz, David]
Language: eng
Format: epub
Tags: Python (Computer Program Language), Programming Languages, Electronic Books, Text Processing (Computer Science), Computers, Desktop Applications, Word Processing, General, Python, Document Management
ISBN: 0321112547
Google: GxKWdn7u4w8C
Amazon: 0321112547
Goodreads: 853143
Publisher: Addison-Wesley Professional
Published: 2003-06-02T00:00:00+00:00


re.subn(pattern=…, repl=…, string=…[,count=0])

Identical to re.sub () , except return a 2-tuple with the new string and the number of replacements made.

>>> import re >>> s = 'abc123 xyz666 lmn-11 def77' >>> re.subn(r'([a-z]+)(\d+)', r' :', s) ('123abc : 666xyz : lmn-11 77def :', 3)

SEE ALSO: re.sub() 246;

CLASS FACTORIES

As with some other Python modules, primarily ones written in C, re does not contain true classes that can be specialized. Instead, re has several factory-functions that return instance objects. The practical difference is small for most users, who will simply use the methods and attributes of returned instances in the same manner as those produced by true classes.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.