On 20 December 2011 15:35, Peter Otten <__pete...@web.de> wrote:
escape_map = {
> ... u'\n': u'\\n',
> ... u'\t': u'\\t',
> ... u'\r': u'\\r',
> ... u'\f': u'\\f',
> ... u'\\': u''
> ... }
escape_map = dict((ord(k), v) for k, v in escape_map.items())
print u"
Arnaud Delobelle wrote:
> I've got to escape some unicode text according to the following map:
>
> escape_map = {
> u'\n': u'\\n',
> u'\t': u'\\t',
> u'\r': u'\\r',
> u'\f': u'\\f',
> u'\\': u''
> }
>
> The simplest solution is to use str.replace:
>
> def escape_text(tex
On 20 December 2011 14:54, Tim Chase wrote:
> On 12/20/11 08:02, Arnaud Delobelle wrote:
>>
>> Hi all,
>>
>> I've got to escape some unicode text according to the following map:
>>
>> escape_map = {
>> u'\n': u'\\n',
>> u'\t': u'\\t',
>> u'\r': u'\\r',
>> u'\f': u'\\f',
>> u'\\
On 12/20/11 08:02, Arnaud Delobelle wrote:
Hi all,
I've got to escape some unicode text according to the following map:
escape_map = {
u'\n': u'\\n',
u'\t': u'\\t',
u'\r': u'\\r',
u'\f': u'\\f',
u'\\': u''
}
The simplest solution is to use str.replace:
def escape_
Hi all,
I've got to escape some unicode text according to the following map:
escape_map = {
u'\n': u'\\n',
u'\t': u'\\t',
u'\r': u'\\r',
u'\f': u'\\f',
u'\\': u''
}
The simplest solution is to use str.replace:
def escape_text(text):
return text.replace('\\', '').