Re: How to convert ASCII to Hexadecimal format?

2007-09-22 Thread Erich Dollansky

Hi,

man hexdump

will explain the details.

Erich

ronggui wrote:

for example:
ASCII: a test
HEX : 61 20 74 65 73 74

Thanks


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to convert ASCII to Hexadecimal format?

2007-09-22 Thread Heiko Wundram (Beenic)
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(),
---

[EMAIL PROTECTED] ~]$ python test.py this is a test
74 68 69 73 20 69 73 20 61 20 74 65 73 74
[EMAIL PROTECTED] ~]$

-- 
Heiko Wundram
Product  Application Development
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]