[Python-es] Como escapo el backslash en un string?

Diego Uribe Gamez diego.uribe.gamez en gmail.com
Vie Abr 12 19:33:05 CEST 2013


aqui, si lo cogio, pero igual la cosa es que en el código no lo tiene y
tengo es que agregarlo:

>>> "\x00"
'\x00'
>>> "\x" + "00"
ValueError: invalid \x escape



El 12 de abril de 2013 12:22, Diego Uribe Gamez <diego.uribe.gamez en gmail.com
> escribió:

> si, el problema es que no es para un print y el string tiene que quedar
> así "hola\x" no asi "hola\\x"
>
>
>
> El 12 de abril de 2013 12:03, Enrique Nuñez <enunezf en gmail.com> escribió:
>
> Esto es lo q necestas?
>> >>> print "hola\x"
>> ValueError: invalid \x escape
>> >>> print "hola\\x"
>> hola\x
>> >>>
>>
>>
>>
>> El 12 de abril de 2013 12:53, Diego Uribe Gamez <
>> diego.uribe.gamez en gmail.com> escribió:
>>
>>> Hola,
>>>
>>> quiero escapar el backslash en un string pero me sale un error o me
>>> salen dos, la idea es que quede así '\x' como hago?
>>>
>>> >>> "\\x"
>>> '\\x'
>>> >>> r'\x'
>>> '\\x'
>>> >>> "\x"
>>> ValueError: invalid \x escape
>>>
>>> --
>>>   *Diego Alonso Uribe Gamez*
>>> ------------------------------
>>>
>>> *Desarrollador web*
>>>
>>> Twitter: @DiegoUG <http://www.twitter.com/DiegoUG>
>>>
>>> Google+: http://gplus.to/diegoug
>>> ------------------------------
>>>
>>>
>>> _______________________________________________
>>> Python-es mailing list
>>> Python-es en python.org
>>> http://mail.python.org/mailman/listinfo/python-es
>>> FAQ: http://python-es-faq.wikidot.com/
>>>
>>>
>>
>> _______________________________________________
>> Python-es mailing list
>> Python-es en python.org
>> http://mail.python.org/mailman/listinfo/python-es
>> FAQ: http://python-es-faq.wikidot.com/
>>
>>
>
>
> --
>   *Diego Alonso Uribe Gamez*
> ------------------------------
>
> *Desarrollador web*
>
> Twitter: @DiegoUG <http://www.twitter.com/DiegoUG>
>
> Google+: http://gplus.to/diegoug
> ------------------------------
>
>


-- 
  *Diego Alonso Uribe Gamez*
------------------------------

*Desarrollador web*

Twitter: @DiegoUG <http://www.twitter.com/DiegoUG>

Google+: http://gplus.to/diegoug
------------------------------
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://mail.python.org/pipermail/python-es/attachments/20130412/50f67879/attachment.html>


Más información sobre la lista de distribución Python-es