Created
October 28, 2014 11:14
-
-
Save binzeehale/7cd19912260d5eb613f5 to your computer and use it in GitHub Desktop.
Make r in string. raw_string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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