我正在用Python 3.3.2制作这个毕达哥拉斯定理计算器。
我打印了几行,以便可以绘制图表:
print("Welcome to the Pythagoras Theorem Calculator, powered by Python!")
print("Below are the values a, b and c. You will need to input these values after.")
print('''
| .
| .
| .
side a| . side c
| .
| .
|_____________.
side b
''')
正如您在上面看到的,需要三个撇号来代替语音标记。为什么会这样呢?它是转义符吗?(我尝试过在Google上进行搜索:http : //bit.ly/15a4zes)
三个引号使您可以在多行上创建一个字符串。它避免您在\n
任何地方添加或执行多个print
语句。
建议 使用 Threes引号字符串 进行文档编制,请参阅PEP 257约定(另请参阅本帖子的评论)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句