binary representaion of a number
Mike Fletcher
mfletch at tpresence.com
Mon Aug 21 01:33:38 EDT 2000
String substitution, a C-ism ported to Python...
http://www.python.org/doc/current/lib/typesseq-strings.html#l2h-33
http://www.linux.com/development/man/3/sprintf/
Examples:
'%08x' --> 0-padded hexidecimal notation for integers
'%08i' --> 0-padded decimal (integer) notation
'%012.3f' --> 0-padded float notation with 3 decimal places ( 12 gives the
minimum length of the string, 3 the length of the decimal, 0 the 0-padding,
f the notation type)
'%12.3f' --> space-padded version of the same
HTH,
Mike
-----Original Message-----
From: David Broadwell [mailto:dbroadwell at mindspring.com]
Sent: Monday, August 21, 2000 1:00 AM
To: python-list at python.org
Subject: Re: binary representaion of a number
Neil Schemenauer wrote:
...
Straitforward, I believe almost precisely what I was looking for.
Thank you.
Now, with the 'for digit in ("%0.8x" % n):' statement I am haveing
some difficulty understanding the '("%0.8x" % n)' notaion ...
--
http://www.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list