如何摆脱Python中的正斜杠raw_input()

Jor*_*an 1 python slash forward raw-input

初学者程序员在这里.所以忍受我.我有一个简单的python程序.

print "How tall are you?",
height = raw_input()

print "So you're %r tall" %(height)
Run Code Online (Sandbox Code Playgroud)

如果我输入高度为6'6''将输出python

所以你是'6\6"'

如何从输出中删除正斜杠"\"?

提前致谢!

Joh*_*ooy 7

%r转换为高度的再版,你应该使用%s,而不是

如果您使用的是Python> = 2.6,则可以这样写

print "So you're {height} tall.".format(height=height)
Run Code Online (Sandbox Code Playgroud)