def add_flowing_data(self, data):
if not data: return
# The following looks a bit convoluted but is a great improvement over
- # data = regsub.gsub('[' + string.whitespace + ']+', ' ', data)
prespace = data[:1].isspace()
postspace = data[-1:].isspace()
data = " ".join(data.split())
# Functions which aren't available as string methods.
# Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def".
-# See also regsub.capwords().
def capwords(s, sep=None):
"""capwords(s, [sep]) -> string
return ''.join(L)
-\f
+
####################################################################
import re as _re
return self.pattern.sub(convert, self.template)
-\f
+
####################################################################
# NOTE: Everything below here is deprecated. Use string methods instead.
# This stuff will go away in Python 3.0.
return s.capitalize()
# Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def".
-# See also regsub.capwords().
def capwords(s, sep=None):
"""capwords(s, [sep]) -> string