


























这是一个创建于 2035 天前的主题,其中的信息可能已经有所发展或是发生改变。
F5 运行多次,每次换行还不一样

代码
class Singleton(object):
def __init__(self):
import time
time.sleep(1)
@classmethod
def instance(cls, *args, **kwargs):
if not hasattr(Singleton, "_instance"):
Singleton._instance = Singleton(*args, **kwargs)
return Singleton._instance
import threading
def task(arg):
obj = Singleton.instance()
print(obj)
for i in range(10):
t = threading.Thread(target=task,args=[i,])
t.start()
配置如下
{
"keys":["f5"],
"caption":"SublimeREPL: save & Python - RUN current file",
"command":"chain",
"args":
{
"commands":[
["save"],
[ "run_existing_window_command",{"id": "repl_python_run","file": "config/Python/Main.sublime-menu"}]
]
}
},
第 1 条附言 · 2020 年 11 月 16 日
已用上Terminus https://github.com/randy3k/Terminus 配合插件Chain of Command,运行前先保存,配置如下
{
"keys":["f5"],
"caption":"Terminus: save & Python",
"command":"chain",
"args":
{
"commands":[
["save"],
["toggle_terminus_panel",{"cwd" :"${file_path:${folder}}","cmd" : [ "python","-i","$file" ],},]
]
}
},
1 floyda 2020 年 11 月 16 日不一样是你 Python 代码的问题, 和 Sublime 无关. |
3 brucmao 2020 年 11 月 16 日 |
4 milkpuff 2020 年 11 月 16 日新建一个 Sublime Text 3\Data\Packages\Python\Python.sublime-build 文件,写入如下内容,ctrl+shift+b,就可以调用 cmd 运行脚本了 "env": {"PYTHONIOENCODING": "utf-8"}, "variants": |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。