gpt4 book ai didi

python - 从 Python 中的 Vte(GTK 终端小部件)获取当前工作目录

转载 作者:太空宇宙 更新时间:2023-11-04 11:00:29 27 4
gpt4 key购买 nike

嘿,如何在 Python 中获取 VTE 小部件的当前工作目录?谢谢。

最佳答案

从 Mark 那里借用一个稍微更优雅的方法:

import vte
import os
v = vte.Terminal()
vPid = v.fork_command()
workingDir = os.readlink('/proc/%s/cwd' % vPid)

关于python - 从 Python 中的 Vte(GTK 终端小部件)获取当前工作目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6016219/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com