sublimitext view run\ u命令似乎有

2024-04-27 10:49:37 发布

您现在位置:Python中文网/ 问答频道 /正文

在下面的代码中,如果需要进行文本编辑,则会成功。如果不需要,我会在控制台中看到“try and close”。但景色并没有关闭。 我试过关闭和关闭文件。你知道吗

if not text == orig:
    view.run_command('select_all')
    view.run_command('cut')
    view.run_command('insert_text', {'string': text})
else:
    #no change, close if it wasnt already open
    if not open_stat:
        print('try and close')
        view.run_command('close')

Tags: and文件run代码textviewcloseif