ID EN
Text Wrapping

dedent

Python 3.11 🇮🇩 Bahasa Indonesia

Hapus spasi putih di depan yang umum dari setiap baris dalam teks.

Syntax

PYTHON
textwrap.dedent(text)

Contoh

Example 1
PYTHON
def test():
     end first line with \ to avoid the empty line!
    s = '''\
    hello
      world
    '''
    print(repr(s))           prints '    hello\n      world\n    '
    print(repr(dedent(s)))   prints 'hello\n  world\n'