Dear all,
Is it possible to right align
the Ipaddress? Normally we can
right align the list of numbers
by %3u or %7u. How we can right
align the Ipaddress?
I expects below format output
eg 203.199.200.0
203.33.20.0
with regards,
Prabahar
IPnumber.rjust(15)
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 17 Jun 2005 09:46:52 +0100 (BST)
praba kar [EMAIL PROTECTED] wrote:
Is it possible to right align
the Ipaddress? Normally we can
right align the list of numbers
by %3u or %7u. How we can right
align the Ipaddress?
I expects below format output
eg 203.199.200.0
Hi,
the solution is a little more involved, if you want to right justify
each of the
four components of IP number:
import sys
try:
.sIPnumber=sys.argv[1]
except:
. sys.exit(-1)
list_lPcomponents=sIPnumber.split('.')
sRJ=''
for n in list_IPcomponents:
. sRJ+=n.rjust(3)+'.'
print sRJ[:-1]
praba kar [EMAIL PROTECTED] (pk) wrote:
pk Dear all,
pk Is it possible to right align
pk the Ipaddress? Normally we can
pk right align the list of numbers
pk by %3u or %7u. How we can right
pk align the Ipaddress?
pk I expects below format output
pk eg 203.199.200.0
pk 203.33.20.0