using text file to get ip address from hostname
Terry Reedy
tjreedy at udel.edu
Wed Sep 12 17:04:52 EDT 2012
On 9/12/2012 10:41 AM, dkatorza at gmail.com wrote:
> it's not really homework, i found a lab exercise on the web
> and i;m trying to study with it. maybe not the most efficient way.
>
> i have a file with hostnames ordered line by line.
Key fact for this exercise: open files are iterable.
So your top level structure is...
for line in open(<hostname file>):
<process hostname in line>
--
Terry Jan Reedy
More information about the Python-list
mailing list