新军's profileIns'PhotosBlogListsMore ![]() | Help |
Ins' |
|||||
|
|
January 20 小工具之Taka_Editplus_Baks_CleanupEditplus总是自动生成baks文件.
写了个小工具,方便日常使用.并通过py2exe打包成了exe文件
py源码:
#!/usr/bin/env python
#-*-coding:gbk-*- import os import sys import glob path = raw_input('path: \n') def walk_dir(dir, topdown=True): counter = 0 for root, dirs, files in os.walk(dir, topdown): for name in files: realpath = os.path.join(root, name) if realpath[-4:] == '.bak': os.remove(realpath) counter += 1 print 'total removed ' + str(counter) + ' files.\nThanks.\nAuthor: Ins\nTaKa-Studio(http://TaKa-Studio.appspot.com)' walk_dir(path) raw_input('press Enter key to exit') January 03 TaKaCMS-Python DEMO第一个基于自家开发的TaKaCMS-Python的样板DEMO终于可以见人了.:-).
预览地址:http://php-magazine.appspot.com
程序会再进一步优化后发布,这不是alpha版本,甚至没有版本号,只是记录一下. January 02 开机设置ie标题写了一个脚本,每次开机设置IE标题栏,显示当前天气.因人在武汉,所以只显示了武汉的天气.将代码保存为脚本设置为开机自启动即可.
没有做过多的异常处理,看着用就可以.
代码:
[Python Code]
#!/usr/bin/env python
#-*-coding:utf-*- import win32api import win32con import datetime import urllib import re socket = urllib.urlopen('http://mimg.126.com/tianqi/city_share/57494.html') content = socket.read() socket.close() pattern = re.compile('<p>(.*)</p>') m = pattern.findall(content) title = m[0] + ' ' + m[1] keyname = 'Software\\Microsoft\\Internet Explorer\Main' try: key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, keyname, 0, win32con.KEY_ALL_ACCESS) win32api.RegSetValueEx(key, 'Window Title', 0, win32con.REG_SZ, title) win32api.RegCloseKey(key) except: pass |
|
|||
|
|