【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

相关推荐
weixin_413063215 分钟前
测试《A Simple Algorithm for Fitting a Gaussian Function》拟合
python·算法
郝学胜-神的一滴18 分钟前
机器学习数据集完全指南:从公开资源到Sklearn实战
人工智能·python·程序人生·机器学习·scikit-learn·sklearn
不要em0啦22 分钟前
从0开始学python:简单的练习题3
开发语言·前端·python
不要em0啦32 分钟前
从0开始学python:判断与循环语句
开发语言·python
OC溥哥99933 分钟前
2D我的世界创造模式网页版正式出炉——《我们的2D创造世界:无限创意,多人同乐》欢迎来到ourcraft.xin网站上玩
后端·python·阿里云·flask·html·游戏程序
SCBAiotAigc1 小时前
langchain1.2学习笔记(一):安装langchain
人工智能·python·langchain
亓才孓1 小时前
java中的Math.Radom拓展
开发语言·python·算法
yongche_shi2 小时前
第八十八篇: 设计一个配置中心
python·面试宝典·设计一个配置中心
itwangyang5202 小时前
AIDD药物筛选与设计详细方法
人工智能·python
NiceAsiv2 小时前
VSCode之打开python终端 取消conda activate的powershell弹窗
vscode·python·conda