1
import sys, os
X = os.system("ipconfig")
print X
0

I know its simple, I'm just starting python. How would I get X to equal the text that is printed out when I use ipconfig in a normal windows command prompt?

1
  • Using windows? If your using freebsd/linux, I'd consider using file redirection and bypassing the extra python script completely Commented Mar 28, 2012 at 2:27

2 Answers 2

3

you're looking for subprocess.check_output().

Sign up to request clarification or add additional context in comments.

1 Comment

That's the one! Thanks friend
1

Use subprocess: subprocess.checkoutput() or subprocess.Popen()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.