Python Run External Program
When create a program with Python, we can use a script Python Run External Program. We can use this script in command line or in program. Before we can use a command to Python run external program, we must import class in python which handle this command. We can use import os class in our script. So, add this import command in your script/command line :
import os
After we import os class, we can use command os.system or os.popen to Python run external program. We use os.system command if we want to run external program with Python. This is example how to use command ls (list of directory and file in Linux) with Python run external program :
os.system("ls -l")
This command will execute command ls-l in linux and show output from this command. If we want to capture output from Python run external program, we can use command os.popen. This is example how to use Python run external program with function os.popen :
In [46]: listfile = os.popen("ls *.zip","r").read()
In [47]: listfile
Out[47]: 'LargeDataSeismic_CODE.zip\nobspy.segy-0.4.5.zip\n'
This is a simple python scripts how to Python run external program or application.
Source : http://www.frihost.com/forums/vt-62880.html
[8157]788club – Đăng nhập và tải app game bài đổi thưởng uy tín,788club cung cấp sảnh game bài đổi thưởng uy tín. Hướng dẫn tải app 788club nhanh chóng và cách nạp tiền qua Momo tiện lợi. Truy cập để trải nghiệm ngay. visit: 788club