【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

相关推荐
Full Stack Developme8 分钟前
Java DFA算法
java·python·算法
留白_21 分钟前
pandas文件读取与存储
开发语言·python·pandas
我的xiaodoujiao23 分钟前
API 接口自动化测试详细图文教程学习系列25--继续处理testCase中的数据
python·学习·测试工具·pytest
Wang ruoxi26 分钟前
Pygame 小游戏——节奏点击
python·pygame
夕除28 分钟前
AOP 实现 Redis 缓存切面解析
java·开发语言·python
fanjiu202034 分钟前
python查询nightingale监控
python
TechWayfarer1 小时前
IP画像在企业安全中的应用:它能做什么?不能替代什么
网络·python·tcp/ip·安全·网络安全
Rauser Mack1 小时前
不懂编程,但是vibe coding一个扫雷游戏
人工智能·python·游戏·html·prompt
郝学胜-神的一滴1 小时前
Python 高级编程 019:类变量与实例变量彻底解析
开发语言·python·程序人生·软件构建
CTA量化套保1 小时前
期货量化临期合约还能不能做:程序化到期禁开与强平写法
python·区块链