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

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


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
------------------------------
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://mail.python.org/pipermail/python-es/attachments/20130412/a388dc54/attachment.html>


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