In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about the application of the python commands module. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Application of commands module
The commands module is the built-in module of python. It has three functions, which can be seen using help (commands).
FUNCTIONS getoutput (cmd) Return output (stdout or stderr) of executing cmd in a shell. Getstatus (file) Return output of "ls-ld" in a string. Getstatusoutput (cmd) Return (status,output) of executing cmd in a shell.1, commands.getstatusoutput (cmd) returns a tuple (status,output)
The return status of the shell command represented by status, and if successful, 0 is the result of the output of shell
> import commands > status, output = commands.getstatusoutput ("ls") > > print status0 > print outputatom:bookstorecookie.py~2, return the result of ls-ld file execution commands.getstatus (file) 3, judge the output of Shell command commands.getoutput (cmd) > print commands.getoutput ("ls") atom:bookstorecookie.py~commands method
The commands module is the built-in module of Python, and it has three main functions:
Function description getoutput (cmd) Return output (stdout or stderr) of executing cmd in a shell.getstatus (file) Return output of "ls-ld file" in a string.getstatusoutput (cmd) Return (status, output) of executing cmd in a shell. Thank you for reading! This is the end of the article on "what is the application of the python commands module?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.