Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
初级程序员在这里。所以请耐心等待。我有一个简单的 python 程序。
print "How tall are you?", height = raw_input() print "So you're %r tall" %(height)
如果我输入高度为 6'6'' python 会输出
所以你是 '6\6"'
如何摆脱输出中的正斜杠“\”?
提前致谢!
%r转换为高度的 repr,您应该%s改用
%r
%s
如果你使用 Python >=2.6,你可以这样写
print "So you're {height} tall.".format(height=height)