【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

相关推荐
铁手飞鹰16 分钟前
VSCode Python .embed 嵌入式环境黄色波浪线问题
ide·vscode·python
辰辉创聚18 分钟前
重组蛋白表达不出来怎么办?蛋白表达失败、低表达及异常原因解析
python·oracle·eclipse·重组蛋白·蛋白·western blot
淼澄研学1 小时前
基于Docker与iptables的AI智能体网络隔离实操指南
开发语言·python
量化吞吐机1 小时前
程序员学量化开发,先用示例拆清结构
人工智能·python
星辰徐哥1 小时前
打破社媒营销信息差:具身交互智能打造全自动化KOL情报体系
运维·python·自动化·交互·react·数字人
weixin_489690022 小时前
训练素材数据转变过程
人工智能·python
测试19982 小时前
UI自动化测试:窗口截图&文件上传实战
自动化测试·软件测试·python·selenium·测试工具·职场和发展·测试用例
叫我:松哥2 小时前
基于Flask的教师评教管理系统,支持学生和教师两种角色登录
数据库·后端·python·数据挖掘·flask
雷帝木木2 小时前
开源与商业AI工具的选型框架:总拥有成本、定制化与社区活力评估
人工智能·python·深度学习·机器学习