Skip to content

Instantly share code, notes, and snippets.

@binzeehale
Created October 28, 2014 11:14
Show Gist options
  • Save binzeehale/7cd19912260d5eb613f5 to your computer and use it in GitHub Desktop.
Save binzeehale/7cd19912260d5eb613f5 to your computer and use it in GitHub Desktop.
Make r in string. raw_string.
def raw_string(s):
if isinstance(s, str):
s = s.encode('string-escape')
elif isinstance(s, unicode):
s = s.encode('unicode-escape')
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment