【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

相关推荐
Lary_c几秒前
Selenium Webdriver 元素等待方式详解
python·selenium·测试工具·自动化
geovindu2 分钟前
python: Builder Pattern
python·设计模式·建造者模式
不懒不懒4 分钟前
【零基础入门 PyTorch:实现食物图片分类任务】
人工智能·pytorch·python
喵手5 分钟前
Python爬虫实战:从天气抓取到机器学习预测气温!
爬虫·python·机器学习·爬虫实战·预测气温·零基础python爬虫教学·天气采集
猿饵块9 分钟前
python--sys
开发语言·python
故河11 分钟前
Python工具:Conda 包管理器
开发语言·python·conda
Dontla12 分钟前
安装Miniconda安装(Windows)、conda虚拟环境创建、conda虚拟环境激活
windows·python
亦复何言??13 分钟前
ROS2 节点使用 Conda 环境运行 Python 依赖的解决方案
开发语言·python·conda
acanab2 小时前
vscode对isaac lab开发时包不能正常导入的问题
vscode·python
写代码的二次猿6 小时前
安装openfold(顺利解决版)
开发语言·python·深度学习