linux - How do I use python to hit this command and return the result? -


  $ whois abc.com  

I used to hit Python I want to use this command, and then give the result a string of text. How can I do this?

You can use, for example:

  subprocess Import Popen, PIPE Output = Popen (["/ usr / bin / whois", "abc.com"], stdout = PIPE) .communicate () [0]  

Stdout = PIPE parameter stdout to write in a temporary pipe instead of the power console (if you do not want it, remove the stdout parameter].


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -