【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

相关推荐
W是笔名3 分钟前
python___容器类型的数据___序列
开发语言·python
aqi0013 分钟前
15天学会AI应用开发(十一)从TXT文件构建RAG知识库
人工智能·python·大模型·ai编程·ai应用
火星校尉22 分钟前
一场数据基建与消费场景的跨界实验
java·前端·数据库·python·php
Sam092727 分钟前
【AI 算法精讲 14】TF-IDF:词频与逆文档频率
人工智能·python·算法·ai
W是笔名42 分钟前
python_let`s try it 6___BMI计算器
java·前端·python
内蒙深海大鲨鱼1 小时前
数据操作+数据预处理
python
ai生成式引擎优化技术1 小时前
从参数驱动到认知行为驱动:SAI范式的理论转向与WSaiOS认知内核架构
python·架构·django·virtualenv·pygame
想你依然心痛1 小时前
AtomCode在Python数据科学项目中的使用体验:从数据分析到可视化
开发语言·python·数据分析
许彰午1 小时前
75_Python自动化办公之Word与PDF
python·自动化·word
_Jonas1 小时前
Python SqlAlchemy对数据库各种操作整理(MySQL为例)
数据库·python·mysql