【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

相关推荐
m0_74065322几秒前
Golang切片底层原理是怎样的_Golang切片实现原理教程【简明】
jvm·数据库·python
yexuhgu2 分钟前
CSS如何处理CSS逻辑属性兼容性_通过PostCSS转译为物理属性
jvm·数据库·python
m0_624578593 分钟前
CSS如何给Bootstrap背景添加半透明层_使用rgba颜色模式与定位
jvm·数据库·python
m0_470857645 分钟前
CSS如何实现等宽表格布局_利用table-layout与盒模型
jvm·数据库·python
kexnjdcncnxjs10 分钟前
HTML 中使用 EXIF.js 读取图片元数据失败的常见原因与解决方案
jvm·数据库·python
iuvtsrt17 分钟前
Python如何实现定时异步任务_结合asyncio与loop.call_later调用
jvm·数据库·python
m0_4636722017 分钟前
HTML怎么标注成就连续打卡中断_HTML“断连,重新开始”提示【方法】
jvm·数据库·python
m0_5967490918 分钟前
CSS如何解决IE下按钮点击反馈缺失_使用active伪类前缀处理
jvm·数据库·python
iAm_Ike21 分钟前
Python处理分类不平衡问题_使用平衡随机森林提升召回率
jvm·数据库·python
毋语天27 分钟前
Python 常用内置模块详解:日志、随机数、时间、OS 与 JSON
开发语言·python