【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

相关推荐
李可以量化3 小时前
Redis Client 从了解到精通(六):redis-py 服务控制与状态监控辅助函数详解
python
李可以量化3 小时前
Redis Client 从了解到精通(六)下:redis-py 时间、库管理与持久化辅助函数详解
python
晓窗科技3 小时前
AI基座哪家好
大数据·人工智能·python
麻雀飞吧4 小时前
学量化:看到“近期工具推荐”时,先问工具要解决什么问题
人工智能·python
jayson.h4 小时前
python——pdf编辑
前端·python·pdf
聪明蛋子哟4 小时前
多智能体协作的三种模式:从群聊到分层,如何设计可扩展的Agent系统
后端·python·flask
zlwool5 小时前
图纸管理选型:从变更频率到齐套率
java·前端·python·erp·设备erp·非标机械
一晌小贪欢5 小时前
python-第15天:Python 列表推导式
开发语言·python·excel·数据可视化·python办公
逗脑IDE5 小时前
零基础学ESP32:光敏传感器——让ESP32拥有“感光”能力!
python·物联网·esp32·智能家居
Java后端的Ai之路5 小时前
17、Python - 观察者模式
开发语言·人工智能·python·观察者模式·外观模式