We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 199d237 commit 27fcf53Copy full SHA for 27fcf53
Lib/textwrap.py
@@ -436,7 +436,7 @@ def dedent(text):
436
margin = os.path.commonprefix([line for line in lines if line.lstrip()])
437
margin_len = len(margin) - len(margin.lstrip())
438
439
- return "\n".join([line[margin_len:] if line.lstrip() else "\n" if line.endswith("\n") else "" for line in lines])
+ return "\n".join([line[margin_len:] if line.lstrip() else "\n" if line and line[-1] == "\n" else "" for line in lines])
440
441
442
def indent(text, prefix, predicate=None):
0 commit comments