随笔分类 -  Python

摘要:原地址:http://www.linuxany.com/archives/1492.html Python 常用文件及目录操作 [1.os] 1.重命名:os.rename(old, new) 2.删除:os.remove(file) 3.列出目录下的文件:os.listdir(path) 4.获取当前工作目录:os.getcwd() 5.改变工作目录:os.chdir(newdir) 6.创建多... 阅读全文
posted @ 2011-12-05 13:33 网络小虫 阅读(268) 评论(0) 推荐(0)
摘要:import socket,sysimport osimport timeclass A: count=0 def __init__(self,name): self.name =name self.__class__.count+=1 def __del__(self): print self.name mys... 阅读全文
posted @ 2011-11-16 19:24 网络小虫 阅读(1091) 评论(0) 推荐(0)
摘要:原地址没找到,转在这里备用。。。 1. 手动制作python的exe可执行程序Python没有内建一个编译为exe的功能。给python程序的部署带来不少的麻烦。所以就会出现一些py2exe之类的很不错的工具,用于自动把.py文件编译为.exe文件。 最近抽空研究了一下手动实现类似py2exe的功能,希望加强对python的了解。结果还相当不错。把结果记录下来,与大家共享。 1.1. 原理文... 阅读全文
posted @ 2011-11-16 09:18 网络小虫 阅读(5216) 评论(0) 推荐(1)
摘要:import socket,sysimport osimport timeclass A: count=0 def __init__(self,name): self.name =name self.__class__.count+=1 def __del__(self): print self.name mys... 阅读全文
posted @ 2011-11-10 20:16 网络小虫 阅读(854) 评论(0) 推荐(0)
摘要:import smtplibserver=smtplib.SMTP()server.connect("smtp.163.com",25)server.login("user"," pwd")server.sendmail("from@163.com","to@qq.com","'Subject: this is a email from python demo\r\n\r\nJust for te... 阅读全文
posted @ 2011-09-29 17:25 网络小虫 阅读(270) 评论(0) 推荐(0)
摘要:Python具有强大的扩展能力,以下列出了50个很棒的Python模块,包含几乎所有的需要:比如Databases,GUIs,Images, Sound, OS interaction, Web,以及其他。推荐收藏。Graphical interface wxPython http://wxpython.org Graphical interface pyGtk http://www.pygtk... 阅读全文
posted @ 2011-07-29 12:46 网络小虫 阅读(1669) 评论(0) 推荐(0)
摘要:import pyodbcconnection = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=Mide12;UID=sa;PWD=google)cur = connection.cursor()cur.execute("select * from XTSysRight")for row in cur: print '... 阅读全文
posted @ 2011-07-22 10:51 网络小虫 阅读(590) 评论(0) 推荐(0)
摘要:简明 Python 教程 http://sebug.net/paper/python/apbs03.html 阅读全文
posted @ 2011-06-28 23:42 网络小虫 阅读(243) 评论(0) 推荐(0)
摘要:import urllibimport osprint "downding..."url='http://www.dianzhu.net/loadimage.php?itemid=134208'urllib.urlretrieve(url,"test2.png")os.system("test2.png")print "done" 阅读全文
posted @ 2011-06-28 23:39 网络小虫 阅读(285) 评论(0) 推荐(0)
摘要:import urllibimport osprint "downding..."http = urllib.urlopen('http://www.baidu.com')file=open("test.html","w")if http.code ==200: print "donwload succ"while 1: str=http.read(1024) if not len(str): b... 阅读全文
posted @ 2011-06-28 23:37 网络小虫 阅读(332) 评论(0) 推荐(0)