Morning I wonder if anyone can point me in the right direction Im new to Python and just starting to learn how it works ?
As a test Im reading internal IP's from a text file running a loop with nslookup which runs fine. But im not sure how to export the results into a new text file called results. Im pretty sure i need to use the Python library to output the results from os.system("nslookup " + line) to results.txt but am getting lost.....any help appreciated
import os
fh = open('pa2.txt','r+')
fh2 = open('results.txt','w+')
while True:
line = fh.readline
os.system("nslookup " + line)
fh2.writelines(results.txt)
if not line:
break
f.close()