by Devin Yang

建立于: 7年前 ( 更新: 7年前 )

最简化版本的Python系统命令运行范本

#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
from subprocess import Popen, PIPE, STDOUT
#运行的命令
command='ls -l'.split()
proc=Popen(command , stdout=PIPE,stderr=PIPE, universal_newlines=True);
output, error = proc.communicate()

#显示运行结果
if(proc.poll()==0):
     print(output)
else:
     print("{} Error\n".format(error))


 

Tags:

Devin Yang

文章内容无法一一说明,如果您有什么不了解处,欢印提问哦:)

No Comment

Post your comment

需要登入才可留言!

类似文章


laravel,livewire

livewire重要笔记

在开始您的 Livewire 之旅之前,以下是关於公开属性(public properities)的三项基本注意事项:一、属性名称不能与为 Livewire 保留的属性名称冲突(例如$rules或$message)二、保存在公开属性(public properities)中的数据,对前端 JavaScript 是可见的。因此,您不应在其中保存敏感数据。三、属性只能是 JavaScript 友好的数据类型(字符串、整数、数组、布尔值),或以下 PHP 类型之一:Stringable、Collection、DateTime、Model、EloquentCollection。

pip3 install face_recognition

在Raspberry Pi 3上运行脸部辨识软体

爬蟲

selenium安装

Python language bindings for Selenium WebDriver.