homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients
Date 2005年11月20日.06:04:48
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=80475
Suggested code:
import re as _re
_emptylines_with_spaces = _re.compile('(?m)^[ \t]+$')
_prefixes_on_nonempty_lines = _re.compile('(?m)(^[
\t]*)(?:[^ \t\n]+)')
def dedent(text):
 text = _emptylines_with_spaces.sub('', text)
 prefixes = _prefixes_on_nonempty_lines.findall(text)
 margin = min(prefixes or [''])
 if margin:
 text = _re.sub('(?m)^' + margin, '', text)
 return text
History
Date User Action Args
2007年08月23日 14:36:20adminlinkissue1361643 messages
2007年08月23日 14:36:20admincreate

AltStyle によって変換されたページ (->オリジナル) /