【发布时间】:2024-01-04 11:23:01
【问题描述】:
我想在函数中导入一个值,该值将作为函数应该打印的字符串上的转义序列。非常感谢任何帮助。
def vhf(c):
print "...I want this \%s escape sequence" % c
vhf('n')
输出是:
...I want this \n escape sequence
但我希望它是:
...I want this
escape sequence
【问题讨论】:
-
如果可能,您应该切换到 Python v3.7+ - pythonclock.org
标签: python python-2.7 function formatting escaping