摘要: python程序使用pyinstaller打包成单一.exe文件后,想在.exe所在目录下生成一保存配置用的.ini文件,问题是:运行时,如何的到.exe文件所在目录?解决方法:#打包成EXE后,使用EXE所在目录import oscfg_path = os.path.join(os.path.dirname(sys.executable), \ "WordAnyTime.ini")#"WordAnyTime.ini"为配置文件名 阅读全文
posted @ 2011-05-09 16:08 WordAnyTime 阅读(1185) 评论(0) 推荐(0) 编辑
摘要: 《轻轻松松背单词》是一个广泛使用的背单词软件,有丰富的词库资源。读取轻轻松松背单词GDS词库文件,可以在此基础上开发背单词类软件。 #--------------------------------------------- def set_word_file_path(self,word_file_path): #读取轻轻松松背单词GDS词库文件 ''' gds文件格式 第1个单词的英文开始位置 290 +0 长度30 第1个单词的中文开始位置 350 +60 长度42 第2个单词的英文开始位置 418 +128 ''' f = open(wo 阅读全文
posted @ 2011-05-09 15:51 WordAnyTime 阅读(1585) 评论(0) 推荐(0) 编辑
摘要: #单例模式的父类,单例模式的类可以从这个类继承class Singleton(object): def __new__(cls,*args,**kw): if not hasattr(cls,"_instance"): orig = super(Singleton,cls) cls._instance = orig.__new__(cls,*args,**kw) return cls._instance#---------------------------------------#需要使用单例模式的类时,可以从Singleton继承class Parameter(Sing 阅读全文
posted @ 2011-05-09 15:42 WordAnyTime 阅读(807) 评论(2) 推荐(0) 编辑