Python 2 to 3 Conversion

Wildman best_lay at yahoo.com
Sat Feb 17 12:35:32 EST 2018


Thanks to Chris and Ben.  Your suggestions were slightly
different but both worked equally well, although I don't
understand how that can be so.

> struct.pack('256s', ifname[:15].encode('ascii'))
> struct.pack('256s', ifname.encode('ascii'))

I was looking for a reliable way to determine the IP addy
for a given network adapter.  That is what the code does
but I don't understand how it does it either.

Thanks again.  I will continue to research and study the
code in the hope I will understand it.

-- 
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!



More information about the Python-list mailing list