0
我已經使用from MySQLdb import escape_string
來轉義字符串。 如何避免使用字符串來獲取原始字符串?用於MySQL的Unescape字符串Python
我已經使用from MySQLdb import escape_string
來轉義字符串。 如何避免使用字符串來獲取原始字符串?用於MySQL的Unescape字符串Python
隨着"your string".decode("string_escape")
>>> escaped_string = "Hello\\nThere"
>>>
>>> unescaped_string = escaped_string.decode("string_escape")
>>>
>>> escaped_string
'Hello\\nThere'
>>>
>>> unescaped_string
'Hello\nThere'