Miscellany of text-munging functions.
Imported modules
|
|
import string
import types
|
Functions
|
|
docstringLStrip
endsInNewline
greedyWrap
isMultiline
stringyString
|
|
docstringLStrip
|
docstringLStrip ( docstring )
Gets rid of unsightly lefthand docstring whitespace residue.
You'd think someone would have done this already, but apparently
not in 1.5.2.
|
|
endsInNewline
|
endsInNewline ( s )
Returns True if this string ends in a newline.
|
|
greedyWrap
|
greedyWrap ( inString, width=80 )
Given a string and a column width, return a list of lines.
Caveat: I'm use a stupid greedy word-wrapping
algorythm. I won't put two spaces at the end
of a sentence. I don't do full justification.
And no, I've never even heard of hypenation.
|
|
isMultiline
|
isMultiline ( s )
Returns True if this string has a newline in it.
|
|
stringyString
|
stringyString ( object, indentation='' )
Expansive string formatting for sequence types.
list.__str__ and dict.__str__ use repr() to display their
elements. This function also turns these sequence types
into strings, but uses str() on their elements instead.
Sequence elements are also displayed on seperate lines,
and nested sequences have nested indentation.
|