And as an interesting exercise, try print r'test \' print r'test \\' Because of the way raw string parsing is defined, neither of these will pass the parser. In fact, a raw string cannot have a backslash as its last character.