I've a question about double quotes escaping in python string formatting. for example,
print "How tall are you?",
height = raw_input()
print "So you are %r tall" % height
when I put 5" 6' , it returns ' 5\\'6" ' and i don't get why there is a backslash.
You're asking for the representation of the string. Since the string contains both types of quotes, one type must be escaped in order for it to be a proper representation. If you only want what was typed then use %s
instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.