V
V
Vitaly Slyusar2015-05-28 16:16:11
linux
Vitaly Slyusar, 2015-05-28 16:16:11

How to make executable python script with linux commands?

How to make python able to operate with Linux commands. For example, open a folder, copied files, etc.
for example, I need a script that will open 3 folders, how to do it in python?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
zelsky, 2015-05-28
@slusarvitaliy

import os
os.system('cp /home/learnpython/1.py /var/www/')

K
Konstantin Kruglov, 2015-05-29
@k0st1an

There is also such an option https://docs.python.org/3/library/subprocess.html#...
And pipe and code exit and much more
If you need file manipulation https://docs.python.org/3/ library/shutil.html#modu...

Z
zed, 2015-05-28
@zedxxx

There is a good one: amoffat.github.io/sh

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question