【发布时间】:2012-06-21 17:41:14
【问题描述】:
由于我是新手,我开始通过使用 python GUI 编写简单程序来学习 python ..
每次尝试清除控制台时,我都需要定义以下几行代码
import os
def cls():
os.system('cls')
print("Console Cleared")
后来我称之为
cls()
现在我已经厌倦了一遍又一遍地编写上面的代码(每次我打开 gui 窗口)..
所以,我想创建一个名为cls 的模块以供将来使用以节省我的时间..
最后我会这样称呼它
import cls
cls()
有没有办法做到这一点...
谢谢!
【问题讨论】:
标签: python windows python-2.7 pythonpath