[Python-au] String Casting

Michael Bennett mib at homemail.com.au
Fri Mar 25 01:43:15 CET 2005


Try this.

from binascii import *
str = r'\x7e\x0d\x0a'
badstring = str.replace(r'\x', '')
goodstring = unhexlify(badstring)

Seeya
Michael.

Bryce Macdonald wrote:

> Hi
>
> I have a string that is posted to my python program (which I cant 
> control) that contains the literal *r’\x7E\x0D\x0A’* and I want it to 
> convert it to equal *‘~\r\n’*
>
> Is there a way to convert this string ?
>
> Cheers
>
> *Bryce Macdonald*
>
> 4Solutions Information Technology Pty Ltd
>
> Level 21
>
> 201 Miller Street
>
> North Sydney NSW 2060
>
> *AUSTRALIA*
>
> Mob : [+61|0] 414 981 787
>
> Tel : [+61|0] 2 9025 3703
>
> Fax : [+61|0] 2 9980 5089
>
> bryce at 4Solutions.com.au <mailto:bryce at 4Solutions.com.au>
>
> www.4Solutions.com.au <http://www.4Solutions.com.au>
>
> //For all your support needs call us on //**/1300 305 902/**// or 
> e-mail to ////support at 4solutions.co 
> <mailto:support at 4solutions.com.au>m.au 
> <mailto:support at 4solutions.com.au>//
>
>------------------------------------------------------------------------
>
>_______________________________________________
>python-au maillist  -  python-au at starship.python.net
>http://starship.python.net/mailman/listinfo/python-au
>  
>




More information about the python-au mailing list