Created
September 9, 2022 15:08
-
-
Save geryxyz/6c66d25dc9db5fa4142871ea90a21e9d to your computer and use it in GitHub Desktop.
This file contains 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
from textwrap import TextWrapper | |
class LineSafeTextWrapper(TextWrapper): | |
def fill(self, text: str) -> str: | |
return '\n'.join(['\n'.join(self.wrap(line)) for line in text.splitlines() if line.strip() != '']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment