Okay i can get the whois info to out put to the screen but I'm having problems saving to a text file. It isn't saving any of the output in the text file for some reason. Maybe someone could help me
Im only having problems saving output to txt file. I know how to save output to text files normally but its not working in this case for some reason.
If no one can help ill just make a webscrapper and do it that way.
Code
from subprocess import call
import socket
hostname = raw_input("Enter Host Name : ")
IP = socket.gethostbyname(hostname)
output = call(["whois", IP])
print (output)
save= raw_input("Would you like to save to file Y or N")
if save=='Y' or save =='y' or save =='YES' or save=='yes':
print " Save file as(Ex example.txt)"
file = raw_input("File Name: ")
with open(file,'a')as outputs:
#file_open = open(file,'w')
outputs.write(str(output))
#file_open.close
else:
print "You decided not to save the output"
passIm only having problems saving output to txt file. I know how to save output to text files normally but its not working in this case for some reason.
If no one can help ill just make a webscrapper and do it that way.


