linux中sh与py文件的相互调用关系

来源:互联网 发布:重庆seo网站诊断 编辑:程序博客网 时间:2024/04/30 16:19

Linux Python shell 执行文件之间的文件调用

在shell sh 调用py

callpy.sh:#!/bin/bashecho 'start call py'./frompy.pyecho 'end call py'

frompy.py:#!/usr/bin/pythonprint "from python"

在Python py中调用sh

callsh.py:#!/usr/bin/pythonimport sysimport osprint "start call sh file"os.system('./fromsh.sh')print "end call sh file"

fromsh.sh:#!/bin/bashecho "from sh file "
0 0
原创粉丝点击