【发布时间】:2013-05-27 04:12:56
【问题描述】:
我是一个新手编剧,我正在使用交互式 shell -i 测试我的脚本。
这是我的脚本的一部分:
shelp = "min shows the number of minutes\n\
sec shows the number of seconds\n\
min + [NUMBER] adds the number of minutes\n\
sec + [NUMBER] adds the number of seconds"
当我以交互方式运行 shelp 时,它显示:
'min shows the number of minutes\nsec shows the number of seconds\nmin + [NUMBER] adds the number of minutes\nsec + [NUMBER] adds the number of seconds'
我不确定这是否是它应该做的,但有没有办法删除\n,同时仍然能够以交互方式运行我的脚本?
抱歉,如果这个问题已经得到解答,或者我的事实有误
【问题讨论】:
-
如何打印 shelp 绑定?只有 print() 函数将
\n字符转换为结束行。 -
你可以在每一行的末尾使用三引号
"""for multiline strings"""而不是`\n`