在pycharm中调用shell命令 1、 # -*- coding:UTF-8 -*- import subprocess subprocess.call(["ls /home"], shell=True) #subprocess.call(["cat /root/d.txt | grep hello"], shell=True) 执行结果 ssh://[email protected]:22/usr/bin/python -u /app/py_code/test3.py b.sh oracle test 2、 # -*- coding:UTF-8 -*- import subprocess subprocess.call(["cat /home/b.sh"], shell=True) subprocess.call(["sed -i ‘s/hi/hello/g‘ /home/b.sh"], shell=True) subprocess.call(["cat /home/b.sh"], shell=True) 执行结果 ssh://[email protected]:22/usr/bin/python -u /app/py_code/test3.py hi hello
原文地址:https://www.cnblogs.com/effortsing/p/9986047.html
时间: 2024-11-05 14:10:13