【Python】运行tcl、perl程序

只要你的环境可以执行tcl、perl脚本,也就是说安装了perl、tcl的解释器。那么python程序就可以执行tcl、perl。

示例:

python 复制代码
import subprocess

tcl_script_path = "D:\\Perl_WorkSpace\\test.tcl"
tcl_run_result = subprocess.run(['tclsh', tcl_script_path], capture_output=True, text=True)

print("tcl script output:\n", tcl_run_result.stdout)

if tcl_run_result.stderr:
    print("ERROR:", tcl_run_result.stderr)

perl_script_path = "D:\\Perl_WorkSpace\\TXT_COMPARE.pl"
perl_run_result = subprocess.run(['perl', perl_script_path], capture_output=True, text=True)

print("perl script output:\n", perl_run_result.stdout)

if perl_run_result.stderr:
    print("ERROR:", perl_run_result.stderr)

主要使用到了 subprocess模块。关于这个参考如下链接:

https://www.runoob.com/w3cnote/python3-subprocess.html

https://blog.51cto.com/u_16213402/11617608

相关推荐
Wzx19801243 分钟前
python沙箱和docker沙箱你选对了吗?
开发语言·python·docker
Python私教1 小时前
签名 URL 刷新导致审批失效?别急着删掉所有 query
python·安全
牧羊人.3331 小时前
Python 办公自动化从入门到入土|09 数据容器之字典
开发语言·python
Zane19941 小时前
类变量与实例变量:一个共享列表引发的线上事故
后端·python
Python私教1 小时前
一次性批准令牌:挡住旧授权误发新版本的工程设计
python·安全
for_ever_love__2 小时前
python基础语法学习: 数据容器
windows·python·学习
aiqianji2 小时前
文风接近真人的AI生成短篇小说软件有哪些?
人工智能·python
Sylvia33.2 小时前
从轮询到推送:足球数据API架构演进与火星数据技术拆解
java·服务器·网络·python·websocket·架构
瑞码空间2 小时前
Python爬虫进阶实战笔记
开发语言·python·计算机·python爬虫
杨超越luckly3 小时前
Agent应用指南:获取12306官网全量站点及其编码信息
python·数据挖掘·数据分析·可视化·12306