Re: inet_addr() in Python

2007-07-23 Thread brad
Steve Holden wrote: > brad wrote: >> Does Python have an equivalent to C's inet_addr()? >> > socket.inet_aton() produces a four-byte string you can pass as a struct > in_addr, if that's what you are looking for. If you want a number then > use the struct module to manipulate it further. > > >>>

Re: inet_addr() in Python

2007-07-23 Thread Steve Holden
brad wrote: > Does Python have an equivalent to C's inet_addr()? > socket.inet_aton() produces a four-byte string you can pass as a struct in_addr, if that's what you are looking for. If you want a number then use the struct module to manipulate it further. >>> s.inet_aton('127.0.0.1') '\x7f\x