【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

相关推荐
电商数据girl1 小时前
有哪些常用的自动化工具可以帮助处理电商API接口返回的异常数据?【知识分享】
大数据·分布式·爬虫·python·系统架构
CoooLuckly1 小时前
numpy数据分析知识总结
python·numpy
超龄超能程序猿1 小时前
(六)PS识别:源数据分析- 挖掘图像的 “元语言”技术实现
python·组合模式
amazinging2 小时前
北京-4年功能测试2年空窗-报培训班学测开-第四十四天
python·学习·appium
UrbanJazzerati2 小时前
Xlwings安装报错:Connection timed out & WinError 32?一招解决你的安装难题!
python
Tipriest_2 小时前
Python异常类型介绍
开发语言·python·异常
前端付豪2 小时前
21、用 Python + Pillow 实现「朋友圈海报图生成器」📸(图文合成 + 多模板 + 自动换行)
后端·python
猿榜3 小时前
魔改编译-永久解决selenium痕迹(二)
javascript·python
广东数字化转型3 小时前
java jar 启动应用程序
开发语言·python
费弗里3 小时前
Python全栈应用开发利器Dash 3.x新版本介绍(4)
python·dash