#textwrap模块的dedent

dedent用来去除用“”“表示输出段落时段落前缩进的空白,使得靠左输出。
例子:

from sys import exit
from random import randint
from textwrap import dedent

print(dedent("""
        erefdfdf
        ererereeeeeeeeeeeeew
        dddddddddddd
        eeeeeeeeeeeeeeee
        eeeeeeeeeeeee
        """))

print("-"*30)

print("""
        ereerdfdferer
        ererereeeeeeeeeeeee
        dddddddddddd
        eeeeeeeeeeeeee
        eeeeeeeeeeeee
        """)

结果print:

>>> runfile('E:/CS/Python/PythonHardWay/ex43.py', wdir='E:/CS/Python/PythonHardWay')

erefdfdf
ererereeeeeeeeeeeeew
dddddddddddd
eeeeeeeeeeeeeeee
eeeeeeeeeeeee

------------------------------

        ereerdfdferer
        ererereeeeeeeeeeeee
        dddddddddddd
        eeeeeeeeeeeeee
        eeeeeeeeeeeee

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试