以下是代码。dedent()的作用是什么?
当我运行此代码时,结果几乎相同。
print(dedent("""
Like a world class boxer you dodge, weave, slip and
slide right as the Gothon's blaster cranks a laser
past your head. In the middle of your artful dodge
your foot slips and you bang your head on the metal
wall and pass out. You wake up shortly after only to
die as the Gothon stomps on your head and eats you.
"""))
print("""
Like a world class boxer you dodge, weave, slip and
slide right as the Gothon's blaster cranks a laser
past your head. In the middle of your artful dodge
your foot slips and you bang your head on the metal
wall and pass out. You wake up shortly after only to
die as the Gothon stomps on your head and eats you.
""")
dedent
... 你有阅读过它的文档吗? - Matteo Italiadedent
。问题并未涉及标准库的textwrap
模块。事实上,它从一开始就不应该被接受;即使我们知道我们正在讨论哪个dedent
,问题在文档中已经有了直接的答案,而且不清楚为什么会有任何困惑。 - Karl Knechtel