I have this code:
x=os.system("host www.google.com")
b=re.findall(r'\w',x)
print b
But this returns the following error:
TypeError: expected string or buffer
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The return value from os.system is the exit code of the process. This is an integer, not a string, so you’re basically doing this:
I think the function you’re looking for is subprocess.check_output: