> > 6-11 Conversion. > > (a) Create a program that will convert from an integer to an > > Internet Protocol (IP) address in the four-octet format of WWW.XXX.YYY.ZZZ > > (b) Update your program to be able to do the vice verse of the above. > > I think it's is asking to convert a 32-bit int to the dotted form. > > It's a little known fact, but IP addresses are valid in non-dotted > long-int form. Spammers commonly use this trick to disguise their IP > addresses in emails from scanners.
that is correct. don't read too much into it. i'm not trying to validate anything or any format, use old or new technology. it is simply to exercise your skills with numbers (specifically 32-bit/4- byte integers), string manipulation, and bitwise operations. if you wish to use different sizes of numbers, forms of addressing, IPv6, etc., that's up to you. don't forget about part (b), which is to take an IP address and turn it into a 32-bit integer. enjoy! -- wesley ps. since you're on p. 248, there is also a typo in the piece of code right above this exercise, Example 6.4, which is tied to exercise 6-7. "'fac_list'" should really be "`fac_list`", or even better, "repr(fac_list)". see the Errata at the book's website http://corepython.com for more details. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Core Python Programming", Prentice Hall, (c)2007,2001 http://corepython.com wesley.j.chun :: wescpy-at-gmail.com python training and technical consulting cyberweb.consulting : silicon valley, ca http://cyberwebconsulting.com -- http://mail.python.org/mailman/listinfo/python-list