How to right align IPaddress?

qwweeeit at yahoo.it qwweeeit at yahoo.it
Fri Jun 17 05:49:05 EDT 2005


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]
Bye.




More information about the Python-list mailing list