V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
dearmymy
V2EX  ›  Python

请教下关于 Python 运行 Linux 命令行下怎么方便交互

  •  
  •   dearmymy · 2022-07-28 16:56:12 +08:00 · 1852 次点击
    这是一个创建于 609 天前的主题,其中的信息可能已经有所发展或是发生改变。

    一个 python 写得工具程序,运行起来有些会有一些交互。 pc mac 下打算 qt 写。 但是没桌面的 linux 命令行下请问怎么处理好些。 现在交互不多情况下,我起了一个循环处理用户输入命令,但感觉扩展起来很麻烦。 感觉起一个 web 去操作感觉太麻烦了。搜到几个命令行下的 gui ,感觉年久失修。 请问下有什么好库解决么,实在没打算试试命令行下 gui , 感谢

    6 条回复    2022-07-29 18:15:36 +08:00
    AoEiuV020CN
        1
    AoEiuV020CN  
       2022-07-28 17:39:01 +08:00
    我怎么感觉这几天第三次看到这个话题了,python shell 交互的,
    dearmymy
        2
    dearmymy  
    OP
       2022-07-28 17:39:46 +08:00
    @AoEiuV020CN 我去翻翻帖子
    lululau
        3
    lululau  
       2022-07-28 17:43:48 +08:00
    lululau
        4
    lululau  
       2022-07-28 17:43:55 +08:00   ❤️ 1
    fbichijing
        5
    fbichijing  
       2022-07-29 09:54:08 +08:00
    argparse 之类的。
    24owls
        6
    24owls  
       2022-07-29 18:15:36 +08:00
    把交互命令写成简短好记的函数,然后 embed 一个 IPython 引入这些函数,这样扩展性有了而且省事儿
    reference: https://stackoverflow.com/questions/15167200/how-do-i-embed-an-ipython-interpreter-into-an-application-running-in-an-ipython
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3515 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 10:49 · PVG 18:49 · LAX 03:49 · JFK 06:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.