
Python
Mr__fang
无
展开
-
Python一些知识
获取网卡的IP:s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)return socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0X8915, struct.pack('256s', ethname[:15]))[20:24])http://blog.youkuaiyun.com/chgaowei/转载 2011-12-06 08:27:41 · 140 阅读 · 0 评论 -
字符串转换成python中exec能执行的函数
#获得格式化后python能执行的字符串 def getPYExecStr(self, strs): if strs.find('if' + self.marked) != -1: strs = strs[strs.find('if' + self.marked):] backStr = '' struct = ''原创 2012-01-18 11:57:18 · 2589 阅读 · 0 评论 -
Python win32口操作Excel
公司由于有上传字数限制,代码见下面评论必须在d盘下建立一个1.xlsx文件才能使用原创 2012-02-02 17:06:00 · 1334 阅读 · 5 评论 -
python学习笔记——文件
http://www.cnblogs.com/rubylouvre/archive/2011/06/22/2086160.html os模块属性属性名描述linesep用于在文件中分隔行的字符串sep用于分隔文件路径名的字符串pathseq用于分隔文件路径的字符串curdir当前工作目录的字符串名转载 2011-12-30 22:16:26 · 123 阅读 · 0 评论 -
windows 编译 python脚本为exe文件
安装 http://cx-freeze.sourceforge.net/ C:\Python27\Scripts\cxfreeze.bat python路径要修改对在需要编译的 .py 文件同文件夹新建一个 setup.py 代码为 #!/usr/bin/env pythonfrom cx_Freeze import setup,Executablesetu转载 2012-01-04 14:35:31 · 1428 阅读 · 1 评论 -
pyinstaller手册
http://www.pyinstaller.org/export/latest/trunk/doc/Manual.html?format=rawpyinstaller手册版本:pyinstaller v1.6dev主页:http://www.pyinstaller.org作者:乔凡尼的研究和威廉(根据戈登麦克米伦手册)接触:翻译 2012-01-04 23:00:12 · 14121 阅读 · 0 评论 -
httplib2---python下的http请求终结者
httplib2功能介绍:http://code.google.com/p/httplib2/httplib2实例页面:http://code.google.com/p/httplib2/w/listhttplib2问题提交:http://code.google.com/p/httplib2/issues/list好吧,我觉得官方的样例还是比较全的,这里就直转载 2012-04-17 09:05:45 · 1922 阅读 · 0 评论 -
Python内置函数清单
Python内置(built-in)函数随着python解释器的运行而创建。在Python的程序中,你可以随时调用这些函数,不需要定义。最常见的内置函数是:print("Hello World!")在Python教程中,我们已经提到下面一些内置函数:基本数据类型 type()反过头来看看 dir() help() len()词典 len()转载 2012-11-09 16:42:40 · 1030 阅读 · 0 评论 -
python总结(拷贝)
不错的python总结,有时间转过来http://www.iteye.com/topic/427429这篇文章只是简单的增加了一些内容,其中包括之前的那一篇总结。为了防止日后重装系统清空硬盘,贴上网,方便日后查阅。import sqlite3conn=sqlite3.connect('test.db')cur=conn.cursor()cur.execute转载 2011-12-31 14:12:29 · 577 阅读 · 0 评论 -
正则表达式截取成对括号
strs = '1(2(3(4(5(67)6)7)8)9)0'reg1 = re.compile('\(([^()])*\)') #一对括号reg2 = re.compile('\(([^()]|\([^()]*\))*\)') #两对括号reg3 = re.compile('\(([^()]|\([^()]*\)|\(([^()]|\([^()]*\))*\))*\)') #三层原创 2012-01-18 11:42:32 · 9170 阅读 · 0 评论 -
Python操作Word、EXCEL,ACCESS
Python操作Word、EXCEL,ACCESS2007-04-03 16:35python Excel 编程1)Excel hyperlink:xlsApp = win32com.client.Dispatch('Excel.Application')cell = xls.App.ActiveSheet.Cells(1,1)cell.Hyperlin转载 2011-12-20 22:08:00 · 4775 阅读 · 0 评论 -
python操作Excel读写(使用xlrd和xlrt)
导入import xlrd打开exceldata = xlrd.open_workbook('demo.xls') #注意这里的workbook首字母是小写查看文件中包含sheet的名称data.sheet_names()得到第一个工作表,或者通过索引顺序 或 工作表名称table = data.sheets()[0]table = data.sheet_by_in转载 2011-12-20 22:20:13 · 66417 阅读 · 1 评论 -
Write Excel files with Python using xlwt
In a previous post (which turned out to be pretty popular) I showed you how to read Excel files with Python. Now for the reverse: writing Excel files.First, you’ll need to install the xlwt package转载 2011-12-20 22:10:52 · 2820 阅读 · 0 评论 -
Python: 50个能够满足所有需要的模块
http://www.iteye.com/news/2639转载 2011-12-14 09:36:57 · 612 阅读 · 0 评论 -
eclipse+pydev 安装和配置 【IBM】
http://apps.hi.baidu.com/share/detail/6816260 PyDev 安装和配置安装 PyDev在安装 PyDev 之前,要保证您已经安装了 Java 1.4 或更高版本、Eclipse 以及 Python。接下来,开始安装 PyDev 插件。启动 Eclipse,利用 Eclipse Update Manager 安装 PyDev。在转载 2011-12-14 22:55:38 · 867 阅读 · 0 评论 -
Python 二进制文件读取显示 .
http://blog.youkuaiyun.com/zfpnuc/article/details/4536309 filename=raw_input('enter file name:') f=open(filename,'rb') f.seek(0,0) index=0 for i in range(0,16): print "%3s" % hex(i) , print f转载 2011-12-27 22:53:41 · 6494 阅读 · 1 评论 -
探索 Python,第 8 部分: 用 Python 的输入输出功能读取和写入数据
http://www.ibm.com/developerworks/cn/opensource/os-python8/读取、写入和 Python在 “探索 Python” 系列以前的文章中,学习了基本的 Python 数据类型和一些容器数据类型,例如tuple、string 和 list。其他文章讨论了 Python 语言的条件和循环特性,以及它们如何与容器数据类型进行协作来简化编程任转载 2011-12-27 22:56:24 · 831 阅读 · 0 评论 -
Python wxPython-demo-2.8.4.0.tar.bz2
http://prdownloads.sourceforge.net/wxpython/wxPython-demo-2.8.4.0.tar.bz2原创 2012-01-07 09:08:55 · 805 阅读 · 0 评论 -
70 行 Python 代码编写一个递归下降解析器
第一步:标记化处理表达式的第一步就是将其转化为包含一个个独立符号的列表。这一步很简单,且不是本文的重点,因此在此处我省略了很多。首先,我定义了一些标记(数字不在此中,它们是默认的标记)和一个标记类型:1token_map = {'+':'ADD', '-':'ADD',2 '转载 2013-08-13 17:25:04 · 2145 阅读 · 1 评论