Date: Sat, 22 Sep 2007 09:52:20 +0200 From: "Heiko Wundram (Beenic)" <wundram@beenic.net> To: freebsd-questions@freebsd.org Cc: ronggui <ronggui.huang@gmail.com> Subject: Re: How to convert ASCII to Hexadecimal format? Message-ID: <200709220952.21527.wundram@beenic.net> In-Reply-To: <38b9f0350709220019n227bf345v9006351554c73bdb@mail.gmail.com> References: <38b9f0350709220019n227bf345v9006351554c73bdb@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Am Samstag 22 September 2007 09:19:02 schrieb ronggui: > for example: > ASCII: a test > HEX : 61 20 74 65 73 74 A small Python script to do the same (in case you need more control, adapt it as it suits you). --- #!/usr/bin/python from sys import argv for c in " ".join(argv[1:]).decode("ascii"): print hex(ord(c))[2:].upper(), --- [modelnine@phoenix ~]$ python test.py this is a test 74 68 69 73 20 69 73 20 61 20 74 65 73 74 [modelnine@phoenix ~]$ -- Heiko Wundram Product & Application Development
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709220952.21527.wundram>