Skip to content Skip to sidebar Skip to footer

Escaping The Double Quotes In Python String

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' % h

Solution 1:

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.


Post a Comment for "Escaping The Double Quotes In Python String"