在命令行上用 python tput cup [英] tput cup in python on the commandline

查看:52
本文介绍了在命令行上用 python tput cup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种优雅的解决方案可以在不导入 os 的情况下在 Python 中执行此 shell 脚本?

Is there an elegant solution to do this shell script in Python without importing os ?

    tput cup 14 15; echo -ne "\033[1;32mtest\033[0m" ; tput cup 50 0

这在我的脑海里已经有一段时间了:)

This just has been gnawing in my mind for some time now :)

谢谢

推荐答案

所有 terminfo 功能都可以通过 诅咒.初始化它并使用 curses.tiget*() 获得您关心的功能.

All the terminfo capabilities are accessible via curses. Initialize it and use curses.tiget*() to get the capabilities you care about.

这篇关于在命令行上用 python tput cup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆