Unindenting multi line strings in Python

Published: 24 April 2023
on channel: Python Morsels
563
17

Need a multi-line string but don't want to include a big block of manually dedented text in your Python code? Use textwrap.dedent!

Read an article version of this video at https://pym.dev/dedent/

Find more Python screencasts at https://pym.dev/screencasts/

00:00 Manually dedenting multi-line strings
00:46 Using textwrap.dedent to unindent strings
01:11 Mind your newlines
01:26 Combining dedent with strip to make the code more readable
02:13 dedent maintains relative indentation levels
02:54 Use textwrap.dedent to unindent strings


On this page of the site you can watch the video online Unindenting multi line strings in Python with a duration of hours minute second in good quality, which was uploaded by the user Python Morsels 24 April 2023, share the link with friends and acquaintances, this video has already been watched 563 times on youtube and it was liked by 17 viewers. Enjoy your viewing!