Created
September 4, 2012 15:23
-
-
Save mitchellrj/3622350 to your computer and use it in GitHub Desktop.
Replace whitespace at the beginning of non-empty lines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def strip_non_empty_lines(text): | |
return re.sub(r'^\s+(?=\S)', '', text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment