Where is the cmd command line of python?

anonymity
Release: 2019-06-17 09:45:01
Original
9046 people have browsed it

Python executes the cmd command line. The most typical module is to use subprocess.

Where is the cmd command line of python?

One, Execute cmd and read the return value

import subprocess
p = subprocess.Popen("ls",
        stdout=subprocess.PIPE, universal_newlines=True)
p.wait()
result_lines = p.stdout.readlines()
for line in result_lines:
    print(line)
Copy after login

Two, Execute cmd command

import subprocess
cmd = "ffmpeg -i bb_short.mp4 -vf \"select=\'eq(pict_type,  PICT_TYPE_I)\'\" -vsync vfr out%d.png"
p = subprocess.Popen(cmd, shell=True)
p.wait()
Copy after login

The above is the detailed content of Where is the cmd command line of python?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template