008_standard_lib_os

#!/usr/bin/env python
# Author:liujun

#The standard library

import os
res = os.system("ls -l") #used to execute commands and doesn't return anything
print("res----",res) #the value of res is 0,because os.system doesn't return anything


res = os.popen("ls -l").read()
#used to execute commands and return the result of executing the command
# The read() is needed here
print("popen ----- ",res)

posted on 2018-09-03 14:39  langjitianyadaolao  阅读(82)  评论(0编辑  收藏  举报

导航