【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

相关推荐
2301_776508725 分钟前
Python日志记录(Logging)最佳实践
jvm·数据库·python
2401_8796938718 分钟前
用Python批量处理Excel和CSV文件
jvm·数据库·python
I'm Jie21 分钟前
Swagger UI 本地化部署,解决 FastAPI Swagger UI 依赖外部 CDN 加载失败问题
python·ui·fastapi·swagger·swagger ui
2401_8463416540 分钟前
Python Lambda(匿名函数):简洁之道
jvm·数据库·python
2401_8796938743 分钟前
进阶技巧与底层原理
jvm·数据库·python
阿_旭1 小时前
基于YOLO26深度学习的【桃子成熟度检测与分割系统】【python源码+Pyqt5界面+数据集+训练代码】图像分割、人工智能
人工智能·python·深度学习·桃子成熟度检测
蹦哒1 小时前
Kotlin 与 Java 语法差异
java·python·kotlin
jerryinwuhan1 小时前
python数据挖掘基础
python·数据挖掘·numpy
echome8881 小时前
Python 异步编程实战:asyncio 核心概念与最佳实践
开发语言·网络·python
yunyun321231 小时前
自动化与脚本
jvm·数据库·python