﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-RTY 实践出真知-随笔分类-Python</title><link>http://www.cppblog.com/lauer3912/category/16445.html</link><description>没有理由不学习</description><language>zh-cn</language><lastBuildDate>Tue, 17 Jul 2012 13:38:29 GMT</lastBuildDate><pubDate>Tue, 17 Jul 2012 13:38:29 GMT</pubDate><ttl>60</ttl><item><title>python文件目录遍历保存成xml文件代码</title><link>http://www.cppblog.com/lauer3912/archive/2012/07/12/182990.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 12 Jul 2012 05:30:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2012/07/12/182990.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/182990.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2012/07/12/182990.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/182990.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/182990.html</trackback:ping><description><![CDATA[<div style="margin: 0px auto; width: 650px; height: 2133px; line-height: 30px; padding-top: 10px; overflow: hidden; font-family: Simsun; "><div><br /><a href="http://www.111cn.net/phper/python/41845.htm">http://www.111cn.net/phper/python/41845.htm</a><br />Linux服务器有CentOS、Fedora等，都预先安装了Python，版本从2.4到2.5不等，而Windows类型的服务器也多数安装了Python，因此只要在本机写好一个脚本，上传到对应机器，在运行时修改参数即可。</div><div id="c_ads5" style="width: 300px; overflow: hidden; height: 270px; float: left; "><iframe id="cproIframe3" src="http://cpro.baidu.com/cpro/ui/uijs.php?tu=u179420&amp;tn=text_default_300_250&amp;n=mailangel123_cpr&amp;rsi1=250&amp;rsi0=300&amp;rad=&amp;rss0=%23FFFFFF&amp;rss1=%23FFFFFF&amp;rss2=%230000ff&amp;rss3=%23444444&amp;rss4=%23008000&amp;rss5=&amp;rss6=%23e10900&amp;rsi5=4&amp;ts=1&amp;at=6&amp;ch=0&amp;cad=1&amp;aurl=&amp;rss7=&amp;cpa=1&amp;fv=11&amp;cn=0&amp;if=16&amp;word=http%3A%2F%2Fwww.111cn.net%2Fphper%2Fpython%2F41845.htm&amp;refer=http%3A%2F%2Fwww.google.com.hk%2Furl%3Fsa%3Dt%26rct%3Dj%26q%3Dpython%2B%25E9%2581%258D%25E5%258E%2586%25E7%259B%25AE%25E5%25BD%2595%2B%25E5%2588%259B%25E5%25BB%25BAxml%26source%3Dweb%26cd%3D8%26ved%3D0CF0QFjAH%26url%3Dhttp%253A%252F%252Fwww.111cn.net%252Fphper%252Fpython%252F41845.htm%26ei%3Djl_-T62LNOaSiAeygfH_Bg%26usg%3DAFQjCNGFh_eDkGDefnKTWgvBPPCq7TZsEQ&amp;ready=1&amp;jk=2a51083d8168227a&amp;jn=3&amp;lmt=1335495997&amp;csp=1366,768&amp;csn=1366,708&amp;ccd=32&amp;chi=1&amp;cja=true&amp;cpl=39&amp;cmi=103&amp;cce=true&amp;csl=zh-CN&amp;did=3&amp;rt=6&amp;dt=1342070706&amp;ev=50331648&amp;c01=0&amp;prt=1342070706219" width="300" height="250" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true"></iframe></div><div id="c_ads6" style="width: 350px; overflow: hidden; height: 270px; float: right; text-align: center; "><iframe id="cproIframe4" src="http://cpro.baidu.com/cpro/ui/uijs.php?tu=u179420&amp;tn=text_default_300_250&amp;n=mailangel123_cpr&amp;rsi1=250&amp;rsi0=300&amp;rad=&amp;rss0=%23FFFFFF&amp;rss1=%23FFFFFF&amp;rss2=%230000ff&amp;rss3=%23444444&amp;rss4=%23008000&amp;rss5=&amp;rss6=%23e10900&amp;rsi5=4&amp;ts=1&amp;at=6&amp;ch=0&amp;cad=1&amp;aurl=&amp;rss7=&amp;cpa=1&amp;fv=11&amp;cn=0&amp;if=16&amp;word=http%3A%2F%2Fwww.111cn.net%2Fphper%2Fpython%2F41845.htm&amp;refer=http%3A%2F%2Fwww.google.com.hk%2Furl%3Fsa%3Dt%26rct%3Dj%26q%3Dpython%2B%25E9%2581%258D%25E5%258E%2586%25E7%259B%25AE%25E5%25BD%2595%2B%25E5%2588%259B%25E5%25BB%25BAxml%26source%3Dweb%26cd%3D8%26ved%3D0CF0QFjAH%26url%3Dhttp%253A%252F%252Fwww.111cn.net%252Fphper%252Fpython%252F41845.htm%26ei%3Djl_-T62LNOaSiAeygfH_Bg%26usg%3DAFQjCNGFh_eDkGDefnKTWgvBPPCq7TZsEQ&amp;ready=1&amp;jk=62b1a21389f8475f&amp;jn=3&amp;lmt=1335495997&amp;csp=1366,768&amp;csn=1366,708&amp;ccd=32&amp;chi=1&amp;cja=true&amp;cpl=39&amp;cmi=103&amp;cce=true&amp;csl=zh-CN&amp;did=4&amp;rt=4&amp;dt=1342070706&amp;pn=3|text_default_300_250|6&amp;ev=50331648&amp;c01=0&amp;prt=1342070706219" width="300" height="250" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true"></iframe></div><p style="margin: 0px; padding: 0px; line-height: 24px; ">Python操作文件和文件夹使用的是os库，下面的代码中主要用到了几个函数：</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">os.listdir:列出目录下的文件和文件夹</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">os.path.join:拼接得到一个文件/文件夹的全路径</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">os.path.isfile:判断是否是文件</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">os.path.splitext：从名称中取出一个子部分</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">&nbsp;</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">下面是目录操作的代码</p><table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="margin: 20px 0px; background-color: #ffbb77; background-position: initial initial; background-repeat: initial initial; "><tbody><tr><td width="464" height="27" bgcolor="#FFE7CE" style="font-size: 12px; ">&nbsp;代码如下</td><td width="109" align="center" bgcolor="#FFE7CE" style="font-size: 12px; cursor: pointer; ">复制代码</td></tr><tr><td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" id="copy4447" style="font-size: 14px; line-height: 26px; background-color: #fff4e8; padding: 10px; ">def search(folder, filter, allfile):<br />&nbsp;&nbsp;&nbsp; folders = os.listdir(folder)<br />&nbsp;&nbsp;&nbsp; for name in folders:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; curname = os.path.join(folder, name)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isfile = os.path.isfile(curname)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if isfile:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ext = os.path.splitext(curname)[1]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; count = filter.count(ext)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if count&gt;0:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cur = myfile()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cur.name = curname<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; allfile.append(cur)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; search(curname, filter, allfile)<br />&nbsp;&nbsp;&nbsp; return allfile</td></tr></tbody></table><p style="margin: 0px; padding: 0px; line-height: 24px; ">在返回文件的各种信息时，使用自定义类allfile来保存文件的信息，在程序中只用到了文件的全路径，如果需要同时记录文件的大小、时间、类型等信息，可以仿照代码进行扩充。</p><table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="margin: 20px 0px; background-color: #ffbb77; background-position: initial initial; background-repeat: initial initial; "><tbody><tr><td width="464" height="27" bgcolor="#FFE7CE" style="font-size: 12px; ">&nbsp;代码如下</td><td width="109" align="center" bgcolor="#FFE7CE" style="font-size: 12px; cursor: pointer; ">复制代码</td></tr><tr><td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" id="copy3518" style="font-size: 14px; line-height: 26px; background-color: #fff4e8; padding: 10px; "><p style="margin: 0px; padding: 0px; line-height: 24px; ">class myfile:<br />&nbsp;&nbsp;&nbsp; def __init__(self):<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.name = ""</p></td></tr></tbody></table><p style="margin: 0px; padding: 0px; line-height: 24px; ">得到存储文件信息的数组后，还可以将其另存成xml格式，下面是代码，在使用时，需要从Document中导入xml.dom.minidom</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">下面是保存为xml的代码</p><table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="margin: 20px 0px; background-color: #ffbb77; background-position: initial initial; background-repeat: initial initial; "><tbody><tr><td width="464" height="27" bgcolor="#FFE7CE" style="font-size: 12px; ">&nbsp;代码如下</td><td width="109" align="center" bgcolor="#FFE7CE" style="font-size: 12px; cursor: pointer; ">复制代码</td></tr><tr><td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" id="copy1269" style="font-size: 14px; line-height: 26px; background-color: #fff4e8; padding: 10px; "><p style="margin: 0px; padding: 0px; line-height: 24px; ">def generate(allfile, xml):<br />&nbsp;&nbsp;&nbsp; doc = Document()</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">&nbsp;&nbsp;&nbsp; root = doc.createElement("root")<br />&nbsp;&nbsp;&nbsp; doc.appendChild(root)</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">&nbsp;&nbsp;&nbsp; for myfile in allfile:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file = doc.createElement("file")<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root.appendChild(file)</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = doc.createElement("name")<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file.appendChild(name)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; namevalue = doc.createTextNode(myfile.name)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name.appendChild(namevalue)</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">&nbsp;&nbsp;&nbsp; print doc.toprettyxml(indent="")<br />&nbsp;&nbsp;&nbsp; f = open(xml, 'a+')<br />&nbsp;&nbsp;&nbsp; f.write(doc.toprettyxml(indent=""))<br />&nbsp;&nbsp;&nbsp; f.close()</p></td></tr></tbody></table><p style="margin: 0px; padding: 0px; line-height: 24px; ">执行的代码如下</p><table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="margin: 20px 0px; background-color: #ffbb77; background-position: initial initial; background-repeat: initial initial; "><tbody><tr><td width="464" height="27" bgcolor="#FFE7CE" style="font-size: 12px; ">&nbsp;代码如下</td><td width="109" align="center" bgcolor="#FFE7CE" style="font-size: 12px; cursor: pointer; ">复制代码</td></tr><tr><td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" id="copy5227" style="font-size: 14px; line-height: 26px; background-color: #fff4e8; padding: 10px; "><p style="margin: 0px; padding: 0px; line-height: 24px; ">if __name__ == '__main__':<br />&nbsp;&nbsp;&nbsp; folder = "/usr/local/apache/htdocs"<br />&nbsp;&nbsp;&nbsp; filter = [".html",".htm",".<a href="http://www.111cn.net/phper/php.html" target="_blank" style="font-size: 12px; color: #333333; text-decoration: none; ">php</a>"]<br />&nbsp;&nbsp;&nbsp; allfile = []<br />&nbsp;&nbsp;&nbsp; allfile = search(folder, filter, allfile)<br />&nbsp;&nbsp;&nbsp; len = len(allfile)<br />&nbsp;&nbsp;&nbsp; print "found: " + str(len) + " files"</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">&nbsp;&nbsp;&nbsp; xml = "folder.xml"<br />&nbsp;&nbsp;&nbsp; generate(allfile, xml)</p></td></tr></tbody></table><p style="margin: 0px; padding: 0px; line-height: 24px; ">在Linux命令行状态下，执行Python filesearch.py，便可以生成名为folder.xml的文件。</p><p style="margin: 0px; padding: 0px; line-height: 24px; ">如果要在Windows中运行该程序，需要把folder变量改成Windows下的格式，例如c:\apache2htdocs，然后执行c:python25python.exe filesearch.py（这里假设python的安装目录是c:python25）</p></div><div id="c_ads4" style="margin: 0px 20px 0px 40px; text-align: center; font-family: Simsun; font-size: 12px; line-height: normal; "></div><img src ="http://www.cppblog.com/lauer3912/aggbug/182990.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2012-07-12 13:30 <a href="http://www.cppblog.com/lauer3912/archive/2012/07/12/182990.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Google App Engine正式支持Python 2.7</title><link>http://www.cppblog.com/lauer3912/archive/2012/03/02/167005.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Fri, 02 Mar 2012 12:25:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2012/03/02/167005.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/167005.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2012/03/02/167005.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/167005.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/167005.html</trackback:ping><description><![CDATA[<p style="font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; ">最近，Google在其Google App Engine（以下简称GAE）官方博客上<a target="_blank" href="http://googleappengine.blogspot.com/2012/02/announcing-general-availability-of.html" style="color: #0b59b2; ">宣布</a>正式支持Python 2.7，对开发者来说又多了一种选择。</p><p style="font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; ">GAE在几个月之前实验性的引入了Python 2.7环境，此后一直在修改缺陷和进行优化。随着这次Python 2.7的正式支持，相信对开发人员更有帮助：</p><blockquote style="padding-right: 5px; padding-left: 5px; margin-right: 0px; margin-left: 20px; background-image: url(http://cdn2.infoq.com/styles/cn/i/bg-blockquote.gif); background-color: #ffffff; font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-position: 5px 5px; background-repeat: no-repeat no-repeat; "><p style="margin-top: 0px; ">首先，它支持程序利用并发请求，帮助开发者构建更加稳定、高效的应用。如果你的应用没有完全利用CPU，那么你现在有机会通过并发请求来降低实例的数量。</p><p style="margin-bottom: 0px; ">同时，我们还增加了开发者迫切需要的工具库，包括PIL、NumPy和lxml等，这些库已经被开发者提了将近两千次了。</p></blockquote><p style="font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; ">通过使用GAE，用户可以在Google 基础架构上运行网络应用程序，目前GAE支持使用几种编程语言编写的应用程序，包括Java、Python（2.5和2.7）、Go等语言。</p><p style="font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; ">相比2.5版，Python 2.7提供了<a target="_blank" href="http://code.google.com/intl/zh-CN/appengine/docs/python/python27/newin27.html" style="color: #0b59b2; ">更多的特性和工具库</a>，开发者可以更加得心应手:</p><ol style="font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; "><li>多线程&#8212;&#8212;2.5不支持此特性，在2.7中，开发者可以利用多线程库。单个请求中的所有线程必须在请求时限（在线请求为60秒，离线请求为10分钟）之前完成。</li><li>并发请求&#8212;&#8212;2.5不支持此特性，现在开发者可以在GAE中修改配置来支持并发请求。</li><li>字节码修改&#8212;&#8212;在2.5版本中由于运行时的限制无法修改字节码，Python 2.7不再包括此限制。生成和处理字节码的工具库可以在运行时正常工作。</li><li>字节码上传&#8212;&#8212;2.5版不支持，Python 2.7可以上传.pyc文件，但是不能和.py一起，但是可以上传包含.py和.pyc文件的.zip文件。</li></ol><p style="font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; ">除此之外，两版之间的区别还包括对数据存储的支持、Django、JSON等工具库的版本更新等等。</p><p style="font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; ">GAE的Python 2.7运行时环境支持一下第三方工具库：</p><ol style="font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; "><li><a target="_blank" href="http://lxml.de/index.html" style="color: #0b59b2; ">lxml</a>(2.3)&#8212;&#8212;lxml工具库支持开发者更加方便的处理XML和HTML文档，对于GAE上Web服务的开发人员来说，是个必不可少的工具。</li><li><a target="_blank" href="http://jinja.pocoo.org/2/" style="color: #0b59b2; ">jinja2</a>(2.6)&#8212;&#8212;<a target="_blank" href="http://baike.baidu.com/view/6749819.htm" style="color: #0b59b2; ">Jinja2</a>是基于python的多功能的被广泛使用的模板引擎，功能比较类似于于PHP的Smarty、J2EE的Freemarker和Velocity。 它支持Unicode，并具有集成的沙箱执行环境，Jinja2模板引擎弥补了Django自带模板系统许多不足。Python 2.7不再推荐使用WebApp模板，jinja2成为了替代者。</li><li><a target="_blank" href="http://pypi.python.org/pypi/MarkupSafe" style="color: #0b59b2; ">MarkupSafe</a>(0.15)&#8212;&#8212;MarkupSafe为XML、HTML和XHTML提供了安全转义的字符串。</li><li><a target="_blank" href="http://numpy.scipy.org/" style="color: #0b59b2; ">NumPy(</a>1.6.1)&#8212;&#8212;Numpy提供了若干数据处理的工具。</li><li><a target="_blank" href="http://www.pythonware.com/library/pil/handbook/" style="color: #0b59b2; ">PIL</a>(1.1.7)&#8212;&#8212;全称为Python Imaging Library，提供了许多用于处理图片的函数。</li><li><a target="_blank" href="http://pypi.python.org/pypi/pycrypto/2.3" style="color: #0b59b2; ">PyCrypto</a>(2.3)&#8212;&#8212;全称为Python Cryptography Toolkit，提供了许多密码学算法函数，比如随机数生成等。</li><li><a href="http://pypi.python.org/pypi/setuptools" style="color: #0b59b2; ">setuptools</a>(0.6c11)&#8212;&#8212;帮助开发者下载、构建、安装、升级和卸载Python包。</li><li><a href="http://pythonpaste.org/webob/" style="color: #0b59b2; ">WebOb</a>(1.1.1)&#8212;&#8212;对HTTP请求和响应做了面向对象的封装，GAE将其作为webapp框架的一部分。</li><li><a href="http://www.yaml.org/" style="color: #0b59b2; ">YAML</a>(3.10)&#8212;&#8212;支持可读性高的消息序列化数据格式，GAE SDK使用YAML作为其配置文件的格式。</li></ol><p style="font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; ">除了Python语言之外，GAE还支持Java和Go语言（实验阶段）：</p><blockquote style="padding-right: 5px; padding-left: 5px; margin-right: 0px; margin-left: 20px; background-image: url(http://cdn2.infoq.com/styles/cn/i/bg-blockquote.gif); background-color: #ffffff; font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 19px; background-position: 5px 5px; background-repeat: no-repeat no-repeat; "><p style="margin-top: 0px; ">Google App Engine 支持 Java 5 和 Java 6。在 App Engine 上运行 Java 应用程序时，将使用 Java 6 虚拟机 (JVM) 和标准库运行该应用程序。理想情况下，开发者应使用 Java 6 编译和测试应用程序，以确保本地服务器的工作方式与 App Engine 类似。</p><p style="margin-bottom: 0px; ">App Engine SDK 与 Java 5 兼容，这非常适用于不能方便获取 Java 6 的开发人员（如使用 Mac OS X 的开发人员）。开发者可以将使用 Java 5 编译的类和 JAR 上传到 App Engine。</p></blockquote><p style="list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; color: #737373; font-family: Lucida, 'Lucida Grande', Tahoma, sans-serif; line-height: 19px; background-color: #ffffff; "><em><strong><a href="http://www.infoq.com/cn/author/%E5%B4%94%E5%BA%B7"  f_taxonomyeditor"="" style="text-decoration: none; color: #1c497b !important; padding-top: 0px; padding-right: 2px; padding-bottom: 0px; padding-left: 2px; ">崔康</a>&nbsp;</strong>热情的技术探索者，资深软件工程师，InfoQ编辑，从事企业级Web应用的相关工作，关注性能优化、Web技术、浏览器等领域。</em></p><img src ="http://www.cppblog.com/lauer3912/aggbug/167005.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2012-03-02 20:25 <a href="http://www.cppblog.com/lauer3912/archive/2012/03/02/167005.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Building PySide on Microsoft Windows</title><link>http://www.cppblog.com/lauer3912/archive/2012/01/14/164187.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sat, 14 Jan 2012 13:08:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2012/01/14/164187.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/164187.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2012/01/14/164187.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/164187.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/164187.html</trackback:ping><description><![CDATA[<div><h1>Building PySide on Microsoft Windows</h1><a name="ee68e5b99222bbc29a480fcb0d1d6ee2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(68, 165, 28); text-decoration: none; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); "></a><h2>Prerequisites</h2><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://www.microsoft.com/express/Downloads/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">MS Visual Studio Express 2008</a>&nbsp;<em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: italic; font-weight: inherit; ">[microsoft.com]</em><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: inherit; font-weight: bold; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">NOTE</span></strong>: Visual Studio Express 2010 is not supported</li></ul></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://www.cmake.org/cmake/resources/software.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">CMake</a>&nbsp;<em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: italic; font-weight: inherit; ">[cmake.org]</em></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://code.google.com/p/msysgit/downloads/list" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">Git</a>&nbsp;<em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: italic; font-weight: inherit; ">[code.google.com]</em></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://www.python.org/download/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">Python 2.6 or 2.7</a>&nbsp;<em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: italic; font-weight: inherit; ">[python.org]</em></li></ul><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: inherit; font-weight: bold; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">NOTE</span></strong>: Be sure that git.exe and cmake.exe are all in your&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">PATH</span>.</p><a name="c74c1f42f141c011ca6bd8b1114fc3d0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(68, 165, 28); text-decoration: none; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); "></a><h2>Build</h2><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; ">Open &#8220;Visual Studio Command Prompt&#8221;: [Start Menu]-&gt;Programs-&gt;Microsoft Visual C++ 2008 Express Edition-&gt;Visual Studio Tools</li></ul><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; ">Get build scripts from repository&nbsp;<a href="http://qt.gitorious.org/pyside/packaging" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">http://qt.gitorious.org/pyside/packaging</a>&nbsp;and go to folder &#8220;c:\repositories\packaging\setuptools&#8221;. The script can automatically download the sources, compile them, and create the installer, all in one step.</li></ul><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; ">Run the build.py script (it must be run from &#8220;Visual Studio Command Prompt&#8221;):</li></ul><span style="color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none; ">To build the latest stable binaries for Python 2.7 and Qt 4.7.3, run the script with parameters:</span><div geshi"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><ol style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #afafaf; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\repositories\packaging\setuptools<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\Python27\python.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span>&nbsp;build.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">py</span>&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>d&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>q c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\<a href="http://developer.qt.nokia.com/doc/Qt.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; font-weight: bold; ">Qt</span></a>\4.7.3\bin\qmake.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp;</div></li></ol></div><span style="color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none; ">To build the latest development binaries:</span><div geshi"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><ol style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #afafaf; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\repositories\packaging\setuptools<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\Python27\python.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span>&nbsp;build.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">py</span>&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>d&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>m dev&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>q c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\<a href="http://developer.qt.nokia.com/doc/Qt.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; font-weight: bold; ">Qt</span></a>\4.7.3\bin\qmake.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp;</div></li></ol></div><span style="color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none; ">All build.py parameters:</span><div geshi"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><ol style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #afafaf; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>p&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&lt;</span>package_version<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>&nbsp;Specify package version.&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">Default</span>&nbsp;is latest stable version&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">(</span>1.0.4<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">)</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>d &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Download latest sources from git repository</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>m&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&lt;</span>pyside_version<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>&nbsp;&nbsp;Specify what version of modules to download from git repository<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: blue; ">'dev'</span>&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">(</span>master tag<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">)</span>&nbsp;or&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: blue; ">'stable'</span>&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">(</span>1.0.4 tag<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">)</span>.&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">Default</span>&nbsp;is&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: blue; ">'stable'</span>.</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>q&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&lt;</span>qmake_path<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>&nbsp;&nbsp; &nbsp; &nbsp;Locate qmake</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>e &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check the environment</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>b &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Specify what module to build</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>o &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Create a distribution package only&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #d20020; font-weight: bold; ">using</span>&nbsp;existing binaries</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;</div></li></ol></div><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; ">After the successful build, the final binary distribution can be found in sub-folder &#8220;dist&#8221;:<div geshi"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><ol style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #afafaf; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\repositories\packaging\setuptools\dist\PySide<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>1.0.4qt473.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">win32</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>py2.7.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp;</div></li></ol></div></li></ul><h3>Categories:</h3><ul id="nav_categories" style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://developer.qt.nokia.com/wiki/Category:LanguageBindings" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">LanguageBindings</a><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://developer.qt.nokia.com/wiki/Category:LanguageBindings::PySide" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">PySide</a></li></ul></li></ul></div><img src ="http://www.cppblog.com/lauer3912/aggbug/164187.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2012-01-14 21:08 <a href="http://www.cppblog.com/lauer3912/archive/2012/01/14/164187.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DeVeDe 3.18.0 发布，开源DVD制作工具</title><link>http://www.cppblog.com/lauer3912/archive/2011/11/22/160734.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 22 Nov 2011 12:28:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/11/22/160734.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/160734.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/11/22/160734.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/160734.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/160734.html</trackback:ping><description><![CDATA[<div><p>DeVeDe 是一个用来创建可在家庭DVD播放器中放映的DVD视频光盘，支持几乎所有的视频格式，采用 Python 开发。</p> <p><img src="http://www.oschina.net/uploads/img/200905/15111810_t8aJ.jpg" alt="" /></p> <p>新版本增加对 <a href="http://www.oschina.net/p/ffmpeg">ffmpeg</a> 的支持，修复了菜单显示的问题，支持任务完成后自动关机的功能。</p></div><img src ="http://www.cppblog.com/lauer3912/aggbug/160734.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-11-22 20:28 <a href="http://www.cppblog.com/lauer3912/archive/2011/11/22/160734.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pyjamas - 用python代替javascript编写基于浏览器的应用</title><link>http://www.cppblog.com/lauer3912/archive/2011/09/15/155809.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 14 Sep 2011 22:55:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/09/15/155809.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/155809.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/09/15/155809.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/155809.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/155809.html</trackback:ping><description><![CDATA[<div><a href="http://www.cnblogs.com/coderzh/archive/2010/09/16/Pyjamas-python-write-javascirpt.html">http://www.cnblogs.com/coderzh/archive/2010/09/16/Pyjamas-python-write-javascirpt.html<br /><span class="Apple-style-span" style="color: #333333; font-family: 微软雅黑, verdana, Arial, sans-serif; font-size: 13px; line-height: 24px; -webkit-text-decorations-in-effect: none; background-color: #ffffff; "><h1 class="postTitle" style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-weight: bold; color: #000000; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dddddd; font-size: 14px; "><a id="ctl03_TitleUrl" class="postTitle2" href="http://www.cnblogs.com/coderzh/archive/2010/09/16/Pyjamas-python-write-javascirpt.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #399ab2; ">Pyjamas - 用python代替javascript编写基于浏览器的应用</a></h1><div class="clear" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; clear: both; "></div><div class="postBody" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 14px; line-height: 1.5; "><div id="cnblogs_post_body" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">如果能用python代替Javascript编写基于浏览器的应用，该有多好啊。但是，Javascript是唯一一种能在浏览器里执行的语言（Flash或Silverlight除外）。换个思路，先用Python编写代码，然后在通过编译器转为为Javascript脚本，这样确实是可行的。嗯，已经有人这么干了，就是这个：<a target="_blank" href="http://pyjs.org/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #0066aa; border-bottom-width: 0px; border-bottom-style: initial; border-bottom-color: initial; ">Pyjamas<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /></a></p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-weight: bold; color: #000000; ">Pyjamas的介绍：</h4><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Google 的 Web Toolkit (GWT) 让我们能够完全用 Java&#8482; 代码开发具有 Ajax 功能的 Rich Internet Application (RIA)。可以使用丰富的 Java 工具集（IDE、重构、代码补全、调试器等等）开发出可以部署在所有主流 Web 浏览器中的应用程序。在 GWT 的帮助下，可以编写出在浏览器中运行但是表现与桌面应用程序相似的应用程序。</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">和GWT类似，Pyjamas是一个跨浏览器API，有了它，你可以使用Python编写客户端功能。 使用Pyjamas的优点是你可以用 Python代替HTML和JavaScript编写网络程序，你可以重复使用和导入类和模块。 此外AJAX库还可以解决互用性问题，不用担心程序在IE6, IE7, Firefox, Safari, Opera等浏览器上的兼容问题。</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><img alt="" src="http://pyjs.org/img/overview.png" height="315" width="348" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " />&nbsp;</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">是不是觉得很酷呢？pyjamas有一个演示页面，里面有多个的效果。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">比如：</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">火星登陆游戏：<a target="_blank" href="http://pyjs.org/examples/asteroids/output/Space.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #0066aa; border-bottom-width: 0px; border-bottom-style: initial; border-bottom-color: initial; ">http://pyjs.org/examples/asteroids/output/Space.html</a></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">邮件客户端：<a href="http://pyjs.org/examples/mail/output/Mail.html" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #0066aa; border-bottom-width: 0px; border-bottom-style: initial; border-bottom-color: initial; ">http://pyjs.org/examples/mail/output/Mail.html&nbsp;</a><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">GWTCanvas：<a target="_blank" href="http://pyjs.org/examples/gwtcanvas/output/GWTCanvasDemo.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #0066aa; border-bottom-width: 0px; border-bottom-style: initial; border-bottom-color: initial; ">http://pyjs.org/examples/gwtcanvas/output/GWTCanvasDemo.html&nbsp;</a><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">(HTML5 Canvas?? 有人讨论这个问题在<a target="_blank" href="http://osdir.com/ml/pyjamas-dev/2010-06/msg00600.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #0066aa; border-bottom-width: 0px; border-bottom-style: initial; border-bottom-color: initial; ">这里</a>)&nbsp;</p></div></div></span><br /></a></div><img src ="http://www.cppblog.com/lauer3912/aggbug/155809.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-09-15 06:55 <a href="http://www.cppblog.com/lauer3912/archive/2011/09/15/155809.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Lupa - Python中调用Lua</title><link>http://www.cppblog.com/lauer3912/archive/2011/09/15/155808.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 14 Sep 2011 22:52:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/09/15/155808.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/155808.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/09/15/155808.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/155808.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/155808.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: http://www.cnblogs.com/coderzh/archive/2010/11/29/lupa.htmlLupa - Python中调用LuaLupa将LuaJIT集成到了Python模块中，可以在Python中执行Lua代码。 比较有意思，也许以后用的着，记录一下。基本用法：&gt;&gt;&gt;&nbsp;import&nbsp;lupa&gt;&gt;&gt;&nbsp;fr...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2011/09/15/155808.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/155808.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-09-15 06:52 <a href="http://www.cppblog.com/lauer3912/archive/2011/09/15/155808.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC编译Swig例子注意</title><link>http://www.cppblog.com/lauer3912/archive/2011/09/02/154978.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Fri, 02 Sep 2011 15:58:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/09/02/154978.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/154978.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/09/02/154978.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/154978.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/154978.html</trackback:ping><description><![CDATA[<div><div>使用VC编译程序示例源码的时候，碰到一些变量，这些变量需要说明一下。</div><div><strong>$(PYTHON_INCLUDE)</strong></div><div><strong>$(PYTHON_LIB)</strong></div><div></div><div>一般，在WIndows或者Linux上设置PYTHON_INCLUDE、PYTHON_LIB的变量就可以。如Windows的环境变量设置</div><div><strong>PYTHON_INCLUDE=C:\Python27\include</strong></div><div><strong>PYTHON_LIB=C:\Python27\libs\python27.lib</strong></div></div><img src ="http://www.cppblog.com/lauer3912/aggbug/154978.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-09-02 23:58 <a href="http://www.cppblog.com/lauer3912/archive/2011/09/02/154978.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>python 相关操作使用说明</title><link>http://www.cppblog.com/lauer3912/archive/2011/09/02/154972.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Fri, 02 Sep 2011 13:57:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/09/02/154972.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/154972.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/09/02/154972.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/154972.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/154972.html</trackback:ping><description><![CDATA[<strong><span style="font-size: 24pt; ">1. 读取ini、修改ini &nbsp; 使用</span><span style="font-size: 24pt; ">ConfigParser</span></strong><br />示例代码：<br /><span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-size: medium; ">比如有一个文件Userinfo.ini，里面有这些内容：<br /><br />[userinfo]<br />EngineVersion=0<br />DATVersion=5127<br />FileName=dat-5127.zip<br />FilePath=/pub/antivirus/datfiles/4.x/<br />FileSize=13481555<br />Checksum=6037,021E<br />MD5=aaeb519d3f276b810d46642d782d8921<br />那就可以通过下面这些代码得到MD5的值，简单吧<br /></span><div style="padding-right: 5.4pt; padding-left: 5.4pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #e6e6e6; padding-bottom: 4px; width: 653px; padding-top: 4px; border-top-color: windowtext; border-right-color: windowtext; border-bottom-color: windowtext; border-left-color: windowtext; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; background-position: 0% 50%; background-repeat: initial initial; "><div><span style="font-size: medium; "><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><span style="color: #008000; ">#</span><span style="color: #008000; ">!/usr/bin/env python</span><span style="color: #008000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />#</span><span style="color: #008000; ">&nbsp;-*- coding: utf-8 -*-</span><span style="color: #008000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #000000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #0000ff; ">import</span><span style="color: #000000; ">&nbsp;ConfigParser<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;ConfigParser.ConfigParser()<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.readfp(open(</span><span style="color: #800000; ">'</span><span style="color: #800000; ">update.ini</span><span style="color: #800000; ">'</span><span style="color: #000000; ">))<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />a&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;config.get(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">ZIP</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,</span><span style="color: #800000; ">"</span><span style="color: #800000; ">MD5</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #0000ff; ">print</span><span style="color: #000000; ">&nbsp;a</span></span></div></div><span style="font-size: medium; "><br />&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;<br /></span><span style="font-size: medium; ">写也很简单：<br /><div style="padding-right: 5.4pt; padding-left: 5.4pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #e6e6e6; padding-bottom: 4px; width: 653px; padding-top: 4px; border-top-color: windowtext; border-right-color: windowtext; border-bottom-color: windowtext; border-left-color: windowtext; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; background-position: 0% 50%; background-repeat: initial initial; "><div><span><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><span style="color: #0000ff; ">import</span><span style="color: #000000; ">&nbsp;ConfigParser<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;ConfigParser.ConfigParser()<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #008000; ">#</span><span style="color: #008000; ">&nbsp;set a number of parameters</span><span style="color: #008000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #000000; ">config.add_section(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">book</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.set(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">book</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">title</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">the python standard library</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.set(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">book</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">author</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">fredrik lundh</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.add_section(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">ematter</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.set(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">ematter</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">pages</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #000000; ">250</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #008000; ">#</span><span style="color: #008000; ">&nbsp;write to file</span><span style="color: #008000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #000000; ">config.write(open(</span><span style="color: #800000; ">'</span><span style="color: #800000; ">1.ini</span><span style="color: #800000; ">'</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">w</span><span style="color: #800000; ">"</span><span style="color: #000000; ">))<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span></span></div></div><br />&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;&#215;<br />修改也不难（添加内容）：<br /></span><div style="padding-right: 5.4pt; padding-left: 5.4pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #e6e6e6; padding-bottom: 4px; width: 653px; padding-top: 4px; border-top-color: windowtext; border-right-color: windowtext; border-bottom-color: windowtext; border-left-color: windowtext; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; background-position: 0% 50%; background-repeat: initial initial; "><div><span style="font-size: medium; "><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><span style="color: #008000; ">#</span><span style="color: #008000; ">!/usr/bin/env python</span><span style="color: #008000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />#</span><span style="color: #008000; ">&nbsp;-*- coding: utf-8 -*-</span><span style="color: #008000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #000000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #0000ff; ">import</span><span style="color: #000000; ">&nbsp;ConfigParser<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;ConfigParser.ConfigParser()<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.read(</span><span style="color: #800000; ">'</span><span style="color: #800000; ">1.ini</span><span style="color: #800000; ">'</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />a&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;config.add_section(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">md5</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.set(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">md5</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">value</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">1234</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.write(open(</span><span style="color: #800000; ">'</span><span style="color: #800000; ">1.ini</span><span style="color: #800000; ">'</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">r+</span><span style="color: #800000; ">"</span><span style="color: #000000; ">))&nbsp;&nbsp;&nbsp;&nbsp; #可以把r+改成其他方式，看看结果:)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span></span></div></div><span style="font-size: medium; "><br />修改内容：<br /></span><div style="padding-right: 5.4pt; padding-left: 5.4pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #e6e6e6; padding-bottom: 4px; width: 653px; padding-top: 4px; border-top-color: windowtext; border-right-color: windowtext; border-bottom-color: windowtext; border-left-color: windowtext; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; background-position: 0% 50%; background-repeat: initial initial; "><div><span style="font-size: medium; "><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><span style="color: #008000; ">#</span><span style="color: #008000; ">!/usr/bin/env python</span><span style="color: #008000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />#</span><span style="color: #008000; ">&nbsp;-*- coding: utf-8 -*-</span><span style="color: #008000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #000000; "><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></span><span style="color: #0000ff; ">import</span><span style="color: #000000; ">&nbsp;ConfigParser<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;ConfigParser.ConfigParser()<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.read(</span><span style="color: #800000; ">'</span><span style="color: #800000; ">1.ini</span><span style="color: #800000; ">'</span><span style="color: #000000; ">)<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.set(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">md5</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">value</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">kingsoft</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)&nbsp;&nbsp;&nbsp; #这样md5就从1234变成kingsoft了<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " />config.write(open(</span><span style="color: #800000; ">'</span><span style="color: #800000; ">1.ini</span><span style="color: #800000; ">'</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">r+</span><span style="color: #800000; ">"</span><span style="color: #000000; ">))</span></span></div></div></span><img src ="http://www.cppblog.com/lauer3912/aggbug/154972.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-09-02 21:57 <a href="http://www.cppblog.com/lauer3912/archive/2011/09/02/154972.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>python——浅谈浅拷贝与深拷贝</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/31/154822.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 31 Aug 2011 13:51:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/31/154822.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/154822.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/31/154822.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/154822.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/154822.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p>第一次接触深拷贝和浅拷贝是在c++语言中，python中，也存在着深拷贝和浅拷贝。</p><p>浅拷贝，就是给你一个引用，当源数据改变的时候，你以前获取的引用所指向的数据也会跟着变化；深拷贝，也是给你一个引用，不同的是它拷贝了份资源，给你的引用指向这份拷贝的资源，与源数据无任何联系。</p><p>&nbsp;</p><p>以代码说明一切：</p><div class="highlighter"><ol class="highlighter-py"><li><span>&gt;&gt;&gt;&nbsp;ls&nbsp;=&nbsp;[</span><span class="number">2</span><span>,</span><span class="number">7</span><span>,&nbsp;</span><span class="string">'ac'</span><span>,&nbsp;[</span><span class="string">'2a'</span><span>,&nbsp;</span><span class="number">45</span><span>,</span><span class="number">10</span><span>],&nbsp;{</span><span class="string">'a'</span><span>&nbsp;:&nbsp;</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'b'</span><span>:</span><span class="number">123</span><span>,&nbsp;</span><span class="string">'z'</span><span>:&nbsp;</span><span class="number">4</span><span>,&nbsp;</span><span class="string">'r'</span><span>&nbsp;:&nbsp;</span><span class="number">33</span><span>},&nbsp;</span><span class="number">0</span><span>]</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;ls2&nbsp;=&nbsp;ls</span></li><li><span>&gt;&gt;&gt;&nbsp;ls3&nbsp;=&nbsp;ls[:]</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;</span><span class="keyword">import</span><span>&nbsp;copy</span></li><li><span>&gt;&gt;&gt;&nbsp;ls4&nbsp;=&nbsp;copy.deepcopy(ls)</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;ls</span></li><li><span>[</span><span class="number">2</span><span>,&nbsp;</span><span class="number">7</span><span>,&nbsp;</span><span class="string">'ac'</span><span>,&nbsp;[</span><span class="string">'2a'</span><span>,&nbsp;</span><span class="number">45</span><span>,&nbsp;</span><span class="number">10</span><span>],&nbsp;{</span><span class="string">'a'</span><span>:&nbsp;</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'r'</span><span>:&nbsp;</span><span class="number">33</span><span>,&nbsp;</span><span class="string">'b'</span><span>:&nbsp;</span><span class="number">123</span><span>,&nbsp;</span><span class="string">'z'</span><span>:&nbsp;</span><span class="number">4</span><span>},&nbsp;</span><span class="number">0</span><span>]</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;ls2</span></li><li><span>[</span><span class="number">2</span><span>,&nbsp;</span><span class="number">7</span><span>,&nbsp;</span><span class="string">'ac'</span><span>,&nbsp;[</span><span class="string">'2a'</span><span>,&nbsp;</span><span class="number">45</span><span>,&nbsp;</span><span class="number">10</span><span>],&nbsp;{</span><span class="string">'a'</span><span>:&nbsp;</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'r'</span><span>:&nbsp;</span><span class="number">33</span><span>,&nbsp;</span><span class="string">'b'</span><span>:&nbsp;</span><span class="number">123</span><span>,&nbsp;</span><span class="string">'z'</span><span>:&nbsp;</span><span class="number">4</span><span>},&nbsp;</span><span class="number">0</span><span>]</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;ls3</span></li><li><span>[</span><span class="number">2</span><span>,&nbsp;</span><span class="number">7</span><span>,&nbsp;</span><span class="string">'ac'</span><span>,&nbsp;[</span><span class="string">'2a'</span><span>,&nbsp;</span><span class="number">45</span><span>,&nbsp;</span><span class="number">10</span><span>],&nbsp;{</span><span class="string">'a'</span><span>:&nbsp;</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'r'</span><span>:&nbsp;</span><span class="number">33</span><span>,&nbsp;</span><span class="string">'b'</span><span>:&nbsp;</span><span class="number">123</span><span>,&nbsp;</span><span class="string">'z'</span><span>:&nbsp;</span><span class="number">4</span><span>},&nbsp;</span><span class="number">0</span><span>]</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;ls4</span></li><li><span>[</span><span class="number">2</span><span>,&nbsp;</span><span class="number">7</span><span>,&nbsp;</span><span class="string">'ac'</span><span>,&nbsp;[</span><span class="string">'2a'</span><span>,&nbsp;</span><span class="number">45</span><span>,&nbsp;</span><span class="number">10</span><span>],&nbsp;{</span><span class="string">'a'</span><span>:&nbsp;</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'r'</span><span>:&nbsp;</span><span class="number">33</span><span>,&nbsp;</span><span class="string">'b'</span><span>:&nbsp;</span><span class="number">123</span><span>,&nbsp;</span><span class="string">'z'</span><span>:&nbsp;</span><span class="number">4</span><span>},&nbsp;</span><span class="number">0</span><span>]</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;ls.append(</span><span class="number">2008</span><span>)</span></li><li><span>&gt;&gt;&gt;&nbsp;</span><span class="keyword">print</span><span>&nbsp;ls</span></li><li class="alt"><span>[</span><span class="number">2</span><span>,&nbsp;</span><span class="number">7</span><span>,&nbsp;</span><span class="string">'ac'</span><span>,&nbsp;[</span><span class="string">'2a'</span><span>,&nbsp;</span><span class="number">45</span><span>,&nbsp;</span><span class="number">10</span><span>],&nbsp;{</span><span class="string">'a'</span><span>:&nbsp;</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'r'</span><span>:&nbsp;</span><span class="number">33</span><span>,&nbsp;</span><span class="string">'b'</span><span>:&nbsp;</span><span class="number">123</span><span>,&nbsp;</span><span class="string">'z'</span><span>:&nbsp;</span><span class="number">4</span><span>},&nbsp;</span><span class="number">0</span><span>,&nbsp;</span><span class="number">2008</span><span>]</span></li><li><span>&gt;&gt;&gt;&nbsp;</span><span class="keyword">print</span><span>&nbsp;ls2</span></li><li class="alt"><span>[</span><span class="number">2</span><span>,&nbsp;</span><span class="number">7</span><span>,&nbsp;</span><span class="string">'ac'</span><span>,&nbsp;[</span><span class="string">'2a'</span><span>,&nbsp;</span><span class="number">45</span><span>,&nbsp;</span><span class="number">10</span><span>],&nbsp;{</span><span class="string">'a'</span><span>:&nbsp;</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'r'</span><span>:&nbsp;</span><span class="number">33</span><span>,&nbsp;</span><span class="string">'b'</span><span>:&nbsp;</span><span class="number">123</span><span>,&nbsp;</span><span class="string">'z'</span><span>:&nbsp;</span><span class="number">4</span><span>},&nbsp;</span><span class="number">0</span><span>,&nbsp;</span><span class="number">2008</span><span>]</span></li><li><span>&gt;&gt;&gt;&nbsp;</span><span class="keyword">print</span><span>&nbsp;ls3</span></li><li class="alt"><span>[</span><span class="number">2</span><span>,&nbsp;</span><span class="number">7</span><span>,&nbsp;</span><span class="string">'ac'</span><span>,&nbsp;[</span><span class="string">'2a'</span><span>,&nbsp;</span><span class="number">45</span><span>,&nbsp;</span><span class="number">10</span><span>],&nbsp;{</span><span class="string">'a'</span><span>:&nbsp;</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'r'</span><span>:&nbsp;</span><span class="number">33</span><span>,&nbsp;</span><span class="string">'b'</span><span>:&nbsp;</span><span class="number">123</span><span>,&nbsp;</span><span class="string">'z'</span><span>:&nbsp;</span><span class="number">4</span><span>},&nbsp;</span><span class="number">0</span><span>]</span></li><li><span>&gt;&gt;&gt;&nbsp;</span><span class="keyword">print</span><span>&nbsp;ls4</span></li><li class="alt"><span>[</span><span class="number">2</span><span>,&nbsp;</span><span class="number">7</span><span>,&nbsp;</span><span class="string">'ac'</span><span>,&nbsp;[</span><span class="string">'2a'</span><span>,&nbsp;</span><span class="number">45</span><span>,&nbsp;</span><span class="number">10</span><span>],&nbsp;{</span><span class="string">'a'</span><span>:&nbsp;</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'r'</span><span>:&nbsp;</span><span class="number">33</span><span>,&nbsp;</span><span class="string">'b'</span><span>:&nbsp;</span><span class="number">123</span><span>,&nbsp;</span><span class="string">'z'</span><span>:&nbsp;</span><span class="number">4</span><span>},&nbsp;</span><span class="number">0</span><span>]</span></li></ol></div><p><span><font color="#000000" style="background-color: #f8f8f8; ">第1行，初始化一个list</font></span></p><p><span><font color="#000000" style="background-color: #f8f8f8; ">第2&#8212;5行，浅拷贝与深拷贝</font></span></p><p><span><font color="#000000" style="background-color: #f8f8f8; ">第6&#8212;13行，源数据发生变化前，打印出源数据以及浅拷贝和深拷贝的数据</font></span></p><p><span><font color="#000000" style="background-color: #f8f8f8; ">第14行，源数据增加一个新数据</font></span></p><p><span><font color="#000000" style="background-color: #f8f8f8; ">第15&#8212;22，打印出浅拷贝与深拷贝数据</font></span></p><p><span><font color="#000000" style="background-color: #f8f8f8; "></font></span>&nbsp;</p><p><span><font color="#000000" style="background-color: #f8f8f8; ">看到结果，就明白浅拷贝与深拷贝了</font></span></p></span><img src ="http://www.cppblog.com/lauer3912/aggbug/154822.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-31 21:51 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/31/154822.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>python 数字的一些常用模块</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/31/154820.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 31 Aug 2011 13:14:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/31/154820.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/154820.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/31/154820.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/154820.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/154820.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p>operator提供了常用的数字操作，如：</p><div class="highlighter"><ol class="highlighter-py"><li><span>&gt;&gt;&gt;&nbsp;</span><span class="keyword">import</span><span>&nbsp;operator</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;operator.add(</span><span class="number">2</span><span>,</span><span class="number">5</span><span>)</span></li><li><span></span><span class="number">7</span></li></ol></div><p><span class="number"><font color="#000000" style="background-color: #f8f8f8; ">round函数：</font></span><span class="number"><font color="#000000" style="background-color: #f8f8f8; "></font></span></p><font color="#000000" style="background-color: #f8f8f8; "><div class="highlighter"><ol class="highlighter-py"><li><span>&gt;&gt;&gt;&nbsp;round(</span><span class="number">3.2344</span><span>,</span><span class="number">2</span><span>)</span></li><li class="alt"><span></span><span class="number">3.23</span><span></span></li><li><span>&gt;&gt;&gt;&nbsp;round(</span><span class="number">3.2354</span><span>,</span><span class="number">2</span><span>)</span></li><li class="alt"><span></span><span class="number">3.2400000000000002</span><span></span></li><li><span>&gt;&gt;&gt;&nbsp;</span></li></ol></div><p>random模块中包含了许多随机函数，如：</p><p>random() ,返回[0.0, 1.0]范围中的浮点数</p><p>uniform(),返回[0.0, 1.0)范围中的浮点数</p><p>randint(a,b) 返回[a,b]之间的一个随机整数</p><p>randrange()和randint类似</p><p>choice([a,b,c])返回序列[a,b,c]中的一项</p></font><p><font color="#000000" style="background-color: #f8f8f8; "></font>&nbsp;</p><p><span class="number"><font color="#000000" style="background-color: #f8f8f8; ">decimal模块中包含了许多十进制的整数算法：</font></span></p><span class="number"><div class="highlighter"><ol class="highlighter-py"><li><span>&gt;&gt;&gt;&nbsp;</span><span class="keyword">import</span><span>&nbsp;decimal</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;d1&nbsp;=&nbsp;decimal.Decimal(</span><span class="string">'2.3456'</span><span>)</span></li><li><span>&gt;&gt;&gt;&nbsp;d1.to_integral()</span></li><li class="alt"><span>Decimal(</span><span class="string">"2"</span><span>)</span></li><li><span>&gt;&gt;&gt;&nbsp;d1&nbsp;=&nbsp;decimal.Decimal(</span><span class="string">'2.53456'</span><span>)</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;d1.to_integral()</span></li><li><span>Decimal(</span><span class="string">"3"</span><span>)</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;</span></li></ol></div></span></span><img src ="http://www.cppblog.com/lauer3912/aggbug/154820.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-31 21:14 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/31/154820.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>真正的除法</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/31/154819.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 31 Aug 2011 13:06:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/31/154819.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/154819.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/31/154819.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/154819.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/154819.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p>通常情况下，在其他语言中，包括在python中，除法一般都是如下计算：</p><div class="highlighter"><ol class="highlighter-py"><li><span>&gt;&gt;&gt;&nbsp;</span><span class="number">1</span><span>/</span><span class="number">2</span><span></span></li><li class="alt"><span></span><span class="number">0</span><span></span></li><li><span>&gt;&gt;&gt;&nbsp;</span><span class="number">1</span><span>/</span><span class="number">4</span><span></span></li><li class="alt"><span></span><span class="number">0</span><span></span></li></ol></div><p>&nbsp;</p><p>但是，在数学计算中，应该不是这样的，正确的结果应该是 1/2=0.5, 1/4=0.25才对，简洁而强大的python也为程序员考虑了这一点：</p><div class="highlighter"><ol class="highlighter-py"><li><span>&gt;&gt;&gt;&nbsp;</span><span class="keyword">from</span><span>&nbsp;__future__&nbsp;</span><span class="keyword">import</span><span>&nbsp;division</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;</span><span class="number">1</span><span>/</span><span class="number">2</span><span></span></li><li><span></span><span class="number">0.5</span><span></span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;</span><span class="number">1</span><span>/</span><span class="number">4</span><span></span></li><li><span></span><span class="number">0.25</span></li></ol></div><p><span class="number"><font color="#000000" style="background-color: #f8f8f8; ">嗯&#8230;&#8230;，这才是真正的除法。</font></span></p></span><img src ="http://www.cppblog.com/lauer3912/aggbug/154819.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-31 21:06 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/31/154819.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>python 动态声明变量，使用exec 函数</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/31/154818.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 31 Aug 2011 13:04:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/31/154818.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/154818.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/31/154818.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/154818.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/154818.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p>python本来就是动态语言，做一些动态的东西，应该说是得心应手吧，下面咱们看看先：</p><p>&nbsp;</p><p>有时候可能会有这种需求，动态的声明变量，变量声明还可以动态啊？感觉似乎比较炫。</p><p>那么变量标识符来自哪里呢？比如说可能来自配置文件，数据库，调用接口等等，不管标识符来自，我们先得把它们保存到一个数据结构中，如下例，假如保存到一个list中：</p><div class="highlighter"><ol class="highlighter-py"><li><span>&gt;&gt;&gt;&nbsp;ls&nbsp;=&nbsp;[</span><span class="string">'a1'</span><span>,&nbsp;</span><span class="string">'a2'</span><span>,&nbsp;</span><span class="string">'a3'</span><span>]</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;</span><span class="keyword">for</span><span>&nbsp;i&nbsp;</span><span class="keyword">in</span><span>&nbsp;ls:</span></li><li><span>...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">exec</span><span>(i&nbsp;+&nbsp;</span><span class="string">'=None'</span><span>)</span></li><li class="alt"><span>...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li><span>&gt;&gt;&gt;&nbsp;a1&nbsp;</span><span class="keyword">is</span><span>&nbsp;</span><span class="special">None</span><span></span></li><li class="alt"><span></span><span class="special">True</span><span></span></li><li><span>&gt;&gt;&gt;&nbsp;a1</span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;a2&nbsp;</span><span class="keyword">is</span><span>&nbsp;</span><span class="keyword">not</span><span>&nbsp;</span><span class="special">None</span><span></span></li><li><span></span><span class="special">False</span><span></span></li><li class="alt"><span>&gt;&gt;&gt;&nbsp;a3</span></li><li><span>&gt;&gt;&gt;&nbsp;a3&nbsp;</span><span class="keyword">is</span><span>&nbsp;</span><span class="special">None</span><span></span></li><li class="alt"><span></span><span class="special">True</span><span></span></li><li><span>&gt;&gt;&gt;&nbsp;</span></li></ol></div><p><span><font color="#000000" style="background-color: #f8f8f8; ">上面的代码中，第1行是来自外部的变量标识符，第2&#8212;3行是变量的动态声明，第5&#8212;12是对声明后的变量进行一下测试，声明是否成功</font></span></p></span><img src ="http://www.cppblog.com/lauer3912/aggbug/154818.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-31 21:04 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/31/154818.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Python 中的pyc文件的用途</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/12/153233.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Fri, 12 Aug 2011 13:41:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/12/153233.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/153233.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/12/153233.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/153233.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/153233.html</trackback:ping><description><![CDATA[引用别人的文章：<br /><span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">什么是pyc文件<br />pyc是一种二进制文件，是由py文件经过编译后，生成的文件，是一种byte&nbsp;code，py文件变成pyc文件后，加载的速度有所提高，而且pyc是一种跨平台的字节码，是由python的虚拟机来执行的，这个是类似于JAVA或者.NET的虚拟机的概念。pyc的内容，是跟python的版本相关的，不同版本编译后的pyc文件是不同的，</span><span style="color: #000000; ">2</span><span style="color: #000000; ">.5编译的pyc文件，</span><span style="color: #000000; ">2</span><span style="color: #000000; ">.4版本的python是无法执行的。<br />为什么需要pyc文件<br />这个需求太明显了，因为py文件是可以直接看到源码的，如果你是开发商业软件的话，不可能把源码也泄漏出去吧？所以就需要编译为pyc后，再发布出去。当然，pyc文件也是可以反编译的，不同版本编译后的pyc文件是不同的，根据python源码中提供的opcode，可以根据pyc文件反编译出py文件源码，网上可以找到一个反编译python2.3版本的pyc文件的工具，不过该工具从python2.4开始就要收费了，如果需要反编译出新版本的pyc文件的话，就需要自己动手了（俺暂时还没这能力</span><span style="color: #000000; ">^--^</span><span style="color: #000000; ">）,不过你可以自己修改python的源代码中的opcode文件，重新编译python，从而防止不法分子的破解。<br />生成单个pyc文件<br />python就是个好东西，它提供了内置的类库来实现把py文件编译为pyc文件，这个模块就是&nbsp;py_compile&nbsp;模块。<br />使用方法非常简单，如下所示，直接在idle中，就可以把一个py文件编译为pyc文件了。(假设在windows环境下)<br />&nbsp;<br />import&nbsp;py_compile<br />py_compile.compile(r</span><span style="color: #000000; ">'</span><span style="color: #000000; ">H:/game/test.py</span><span style="color: #000000; ">'</span><span style="color: #000000; ">)<br />&nbsp;<br />compile函数原型：<br />compile(file[,&nbsp;cfile[,&nbsp;dfile[,&nbsp;doraise]]])<br />file&nbsp;表示需要编译的py文件的路径<br />cfile&nbsp;表示编译后的pyc文件名称和路径，默认为直接在file文件名后加c&nbsp;或者&nbsp;o，o表示优化的字节码<br />dfile&nbsp;这个参数英文看不明白，请各位大大赐教。(鄙视下自己)原文：it&nbsp;</span><span style="color: #0000FF; ">is</span><span style="color: #000000; ">&nbsp;used&nbsp;</span><span style="color: #0000FF; ">as</span><span style="color: #000000; ">&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;source&nbsp;file&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;error&nbsp;messages&nbsp;instead&nbsp;of&nbsp;file<br />doraise&nbsp;可以是两个值，True或者False，如果为True，则会引发一个PyCompileError，否则如果编译文件出错，则会有一个错误，默认显示在sys.stderr中，而不会引发异常<br />(来自python2.5文档)<br />批量生成pyc文件<br />一般来说，我们的工程都是在一个目录下的，一般不会说仅仅编译一个py文件而已，而是需要把整个文件夹下的py文件都编译为pyc文件，python又为了我们提供了另一个模块：compileall&nbsp;。使用方法如下：<br />&nbsp;<br />import&nbsp;compileall<br />compileall.compile_dir(r</span><span style="color: #000000; ">'</span><span style="color: #000000; ">H:/game</span><span style="color: #000000; ">'</span><span style="color: #000000; ">)<br />这样就把game目录，以及其子目录下的py文件编译为pyc文件了。嘿嘿，够方便吧。来看下compile_dir函数的说明：<br />&nbsp;<br />compile_dir(dir[,&nbsp;maxlevels[,&nbsp;ddir[,&nbsp;force[,&nbsp;rx[,&nbsp;quiet]]]]])<br />dir&nbsp;表示需要编译的文件夹位置<br />maxlevels&nbsp;表示需要递归编译的子目录的层数，默认是10层，即默认会把10层子目录中的py文件编译为pyc<br />ddir&nbsp;英文没明白，原文：it&nbsp;</span><span style="color: #0000FF; ">is</span><span style="color: #000000; ">&nbsp;used&nbsp;</span><span style="color: #0000FF; ">as</span><span style="color: #000000; ">&nbsp;the&nbsp;</span><span style="color: #0000FF; ">base</span><span style="color: #000000; ">&nbsp;path&nbsp;from&nbsp;which&nbsp;the&nbsp;filenames&nbsp;used&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;error&nbsp;messages&nbsp;will&nbsp;be&nbsp;generated。<br />force&nbsp;如果为True，则会强制编译为pyc，即使现在的pyc文件是最新的，还会强制编译一次，pyc文件中包含有时间戳，python编译器会根据时间来决定，是否需要重新生成一次pyc文件<br />rx&nbsp;表示一个正则表达式，比如可以排除掉不想要的目录，或者只有符合条件的目录才进行编译<br />quiet&nbsp;如果为True，则编译后，不会在标准输出中，打印出信息<br />(来自python2.5文档)<br />总结<br />通过上面的方法，可以方便的把py文件编译为pyc文件了，从而可以实现部分的源码隐藏，保证了python做商业化软件时，保证了部分的安全性吧，继续学习下，看怎么修改opcode。</span></div></h3></span><br />我这里的说明，例如，我当前有如下文件：<br />example.pyc<br />runme.py<br /><br />runme.py 调用的是example.py 文件，但是当前只有pyc文件，那么是不是不可以正常运行呢，答案是：不是的。是可以运行的。 这就是为什么pyc可以用作保密的原因。<br /><br /><br /><br /><br /><br /><br /><img src ="http://www.cppblog.com/lauer3912/aggbug/153233.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-12 21:41 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/12/153233.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PyInstaller 1.5.1 发布，Python 打包工具</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/02/152257.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 01 Aug 2011 23:28:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/02/152257.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152257.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/02/152257.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152257.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152257.html</trackback:ping><description><![CDATA[<span style="font-family: Verdana, Arial, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 13px; "><h2>Stable release<a href="http://www.pyinstaller.org/#Stablerelease" title="Link to this section" style="text-decoration: none; color: #d7d7d7; border-bottom-width: 1px; border-bottom-style: none; border-bottom-color: #bbbbbb; border-top-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; font-size: 0.8em; vertical-align: text-top; visibility: hidden; "></a></h2><p>The latest stable release of PyInstaller is 1.5.1 (<a href="http://www.pyinstaller.org/browser/tags/1.5.1/doc/CHANGES.txt#latest" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">Change Log</a>). See below for download links.<br /></p><h2>Features<a href="http://www.pyinstaller.org/#Features" title="Link to this section" style="text-decoration: none; color: #d7d7d7; border-bottom-width: 1px; border-bottom-style: none; border-bottom-color: #bbbbbb; border-top-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; font-size: 0.8em; vertical-align: text-top; visibility: hidden; "></a></h2><ul><li>Packaging of Python programs into standard executables, that work on computers without Python installed.</li><li>Multiplatform: works under Windows (32-bit and 64-bit), Linux (32-bit and 64-bit) and Mac OS X (32-bit only, 64-bit in svn, see&nbsp;<a href="http://www.pyinstaller.org/wiki/MacOsCompatibility" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">MacOsCompatibility</a>).</li><li>Multiversion: works under any version of Python from 2.2 up to 2.7.</li><li>Flexible packaging mode:<ul><li>Single directory: build a directory containing an executable plus all the external binary modules (.dll, .pyd, .so) used by the program.</li><li>Single file: build a single executable file, totally self-contained, which runs without any external dependency.</li><li>Custom: you can automate PyInstaller to do whatever packaging mode you want through a simple script file in Python.</li></ul></li><li>Explicit intelligent support for many 3rd-packages (for hidden imports, external data files, etc.), to make them work with PyInstaller out-of-the-box (see&nbsp;<a href="http://www.pyinstaller.org/wiki/SupportedPackages" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">SupportedPackages</a>).</li><li>Full single-file EGG support: required .egg files are automatically inspected for dependencies and bundled, and all the egg-specific features are supported at runtime as well (entry points, etc.).</li><li>Partial directory EGG support: required .egg directories are automatically inspected for dependencies and bundled, but egg-specific features will not work at runtime.</li><li>Automatic support for binary libraries used through ctypes (see&nbsp;<a href="http://www.pyinstaller.org/wiki/CtypesDependencySupport" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">CtypesDependencySupport</a>&nbsp;for details).</li><li>Support for automatic binary packing through the well-known&nbsp;<a href="http://upx.sf.net/" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">&nbsp;UPX</a>&nbsp;compressor.</li><li>Optional console mode (see standard output and standard error at runtime).</li><li><strong>Windows-specific features</strong>:<ul><li>Support for&nbsp;<a href="http://www.pyinstaller.org/wiki/CodeSigning" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">code-signing executables</a>.</li><li>Full automatic support for CRTs: no need to manually distribute MSVCR*.DLL, redist installers, manifests, or anything else;&nbsp;<strong>true</strong>&nbsp;one-file applications that work everywhere! (see<a href="http://www.pyinstaller.org/wiki/Python26Win" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">Python26Win</a>)</li><li>Selectable executable icon.</li><li>Fully configurable version resource section and manifests in executable.</li><li>Support for building COM servers.</li></ul></li><li><strong>Mac-specific features</strong>:<ul><li>Support for bundles (see&nbsp;<a href="http://www.pyinstaller.org/wiki/MacOsCompatibility" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">MacOsCompatibility</a>)</li></ul></li></ul><h2>License<a href="http://www.pyinstaller.org/#License" title="Link to this section" style="text-decoration: none; color: #d7d7d7; border-bottom-width: 1px; border-bottom-style: none; border-bottom-color: #bbbbbb; border-top-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; font-size: 0.8em; vertical-align: text-top; visibility: hidden; "></a></h2><p>PyInstaller is distributed under the GPL license (see the file&nbsp;<a href="http://www.pyinstaller.org/browser/trunk/doc/LICENSE.GPL#latest" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">doc/LICENSE.GPL</a>&nbsp;in the source code), with a&nbsp;<strong><em>special exception</em>&nbsp;which allows to use PyInstaller to build and distribute non-free programs</strong>&nbsp;(including commercial ones). In other words, you have no restrictions in&nbsp;<strong>using</strong>&nbsp;PyInstaller as-is, but any kind of&nbsp;<strong>modifications</strong>&nbsp;to it will have to comply with the GPL license. See also our&nbsp;<a href="http://www.pyinstaller.org/wiki/FAQ" style="text-decoration: none; color: #bb0000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #bbbbbb; ">FAQ</a>.</p><div></div></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152257.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-02 07:28 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/02/152257.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在 C++ 中使用 Python script</title><link>http://www.cppblog.com/lauer3912/archive/2011/07/28/151962.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 27 Jul 2011 23:24:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/07/28/151962.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/151962.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/07/28/151962.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/151962.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/151962.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff; "><h5 class="posthead" style="border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted; border-top-width: 0px; border-right-width: 0px; border-left-width: 0px; border-bottom-width: 1px; border-top-color: #dfdfdf; border-right-color: #dfdfdf; border-bottom-color: #dfdfdf; border-left-color: #dfdfdf; color: #529e00; font-size: 1.5em; padding-bottom: 6px; margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 10px; "><a id="viewpost1_TitleUrl" href="http://www.cppblog.com/bigsml/archive/2008/08/14/58859.html" style="color: #006ff7; text-decoration: none; font-size: 0.9em; ">在 C++ 中使用 Python script</a></h5></span><span class="Apple-style-span" style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: normal; background-color: #ffffff; "><div class="post" style="margin-top: 0px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; line-height: 19px; "><div class="postText"><p>想要在c++ 中嵌入script 代码, 除了自己写脚本引擎外, lua, python 都可以在c++ 中使用, 另外<a href="http://dev.kalimdor.org/entropia" style="color: #006ff7; font-size: 0.9em; ">MonoBind</a>, AngelScript library 都是一些c++ script library, 可以嵌入到c++ 中使用 .&nbsp;<br />今天在c++ 中试着嵌入 python 代码 (示例代码在 Python-2.5.2\Demo\embed\ 下)</p><div style="border-right-color: #cccccc; border-right-width: 1px; border-right-style: solid; padding-right: 5px; border-top-color: #cccccc; border-top-width: 1px; border-top-style: solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; width: 523px; word-break: break-all; padding-top: 4px; border-bottom-color: #cccccc; border-bottom-width: 1px; border-bottom-style: solid; background-color: #eeeeee; "><span style="color: #000000; ">#include&nbsp;</span><span style="color: #000000; ">&lt;</span><span style="color: #000000; ">Python.h</span><span style="color: #000000; ">&gt;</span><span style="color: #000000; "><br /></span><span style="color: #0000ff; ">int</span><span style="color: #000000; ">&nbsp;main(</span><span style="color: #0000ff; ">int</span><span style="color: #000000; ">&nbsp;argc,&nbsp;</span><span style="color: #0000ff; ">char</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">*</span><span style="color: #000000; ">argv[])<br />{<br />&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Py_NoSiteFlag&nbsp;=&nbsp;1;<br />&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Py_SetPythonHome("D:\\usr\\Python");&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;PYTHONHOME</span><span style="color: #008000; "><br /></span><span style="color: #000000; "><br />&nbsp;&nbsp;Py_Initialize();<br />&nbsp;&nbsp;PyRun_SimpleString(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">from&nbsp;time&nbsp;import&nbsp;time,ctime\n</span><span style="color: #000000; ">"</span><span style="color: #000000; "><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000; ">"</span><span style="color: #000000; ">print&nbsp;'Today&nbsp;is',ctime(time())\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />&nbsp;&nbsp;Py_Finalize();<br />&nbsp;&nbsp;</span><span style="color: #0000ff; ">return</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />}</span></div><p>在运行时可能会产生类似&nbsp;<strong>'import site' failed; use -v for traceback</strong>&nbsp;的错误, 原因是python 在import module 的时候的路径问题. 有3种方法可以解决(以前通过设置环境变量 PYTHONPATH 好像在2.5 已经无效了).&nbsp;<br />0. 取消注释&nbsp;<font color="#008000">Py_NoSiteFlag&nbsp;=&nbsp;1;&nbsp;</font><br />这个只是取消import site , 当然如果在代码中要import 啥的话, 还是会出现错误的.&nbsp;<br />a. 设置环境变量 PYTHONHOME = D:\usr\Python&nbsp;&nbsp;<br />b. 在调用 Py_Initialize 之前调用函数&nbsp;<br />Py_SetPythonHome("D:\\usr\\Python");&nbsp; // 参数是python 的安装目录&nbsp;<br /><br /><strong>2. 其他一些有用的资源</strong>&nbsp;<br /><a href="http://docs.python.org/api/api.html" style="color: #006ff7; font-size: 0.9em; ">Python/C API Reference Manual</a>&nbsp;(API 参考) ,&nbsp;&nbsp;<a href="http://docs.python.org/ext/ext.html" style="color: #006ff7; font-size: 0.9em; ">Extending and Embedding the Python Interpreter</a>&nbsp;(扩展及嵌入Python解释器, 主要说明了如何扩展Python, 给Python 写扩展, 其中&nbsp;<a href="http://docs.python.org/ext/embedding.html" style="color: #006ff7; font-size: 0.9em; ">5. Embedding Python in Another Application&nbsp;&nbsp;</a>一章讲述了在C++中嵌入/调用Python 代码 )&nbsp;<br /><br /><a href="http://gashero.yeax.com/?p=38" style="color: #006ff7; font-size: 0.9em; ">使用C/C++扩展Python</a>&nbsp; 对文 Extending and Embedding the Python Interpreter 作了精简, 很不错的一篇文章, 但是跳过了一些基础&nbsp;.&nbsp;<br /><br /><a href="http://www.ddj.com/cpp/184401666" style="color: #006ff7; font-size: 0.9em; ">Building Hybrid Systems with Boost.Python</a>&nbsp;介绍了使用boost.python 方便python 插件开发,<a href="http://www.cnblogs.com/xiaotie/archive/2006/02/22/335633.html" style="color: #006ff7; font-size: 0.9em; ">python绑定c++程序</a>&nbsp;是其中文版本.&nbsp;<br /><br /><a href="http://www.linuxjournal.com/article/3641" style="color: #006ff7; font-size: 0.9em; ">Embedding Python in Multi-Threaded C/C++ Applications</a>&nbsp;讲了c++在多线程环境如何使用Python , 文&nbsp;<a href="http://blog.csdn.net/liguangyi/archive/2007/06/20/1659697.aspx" style="color: #006ff7; font-size: 0.9em; ">C++多线程中调用python api函数</a>&nbsp;提供了一个多线程的封装.&nbsp;<br /><br />SCXX - A Simple Python/C++ API<br /><a href="http://davidf.sjsoft.com/mirrors/mcmillan-inc/scxx.html" style="color: #006ff7; font-size: 0.9em; ">http://davidf.sjsoft.com/mirrors/mcmillan-inc/scxx.html</a></p><p>C++扩展和嵌入Python应用 (介绍了一些Python/C API 函数, 以及ext 例子, 一般般)&nbsp;<br /><a href="http://hi.baidu.com/yunsweet/blog/item/20b08aeebaa2b1282cf534c7.html" style="color: #006ff7; font-size: 0.9em; ">http://hi.baidu.com/yunsweet/blog/item/20b08aeebaa2b1282cf534c7.html</a></p><p><br /><strong>3. Python 多线程的使用</strong>&nbsp;<br /><br />zz&nbsp;<a href="http://blog.csdn.net/liguangyi/archive/2007/06/20/1659697.aspx" style="color: #006ff7; font-size: 0.9em; ">http://blog.csdn.net/liguangyi/archive/2007/06/20/1659697.aspx</a>&nbsp;<br />今天看了近一天关于多线程的应用中，如何安全调用python方面的资料，开始的时候看的简直头大如斗，被python语言的全局锁(Global Interpreter Lock)、线程状态(Thread State )等都有点绕晕了，后来经过各方面文章和帮助文档的相互参考，发现对于2.4/2.5版本，提供了PyGILState_Ensure, PyGILState_Release，哎，这下可方便大发了。</p><p>一、首先定义一个封装类，主要是保证PyGILState_Ensure, PyGILState_Release配对使用，而且这个类是可以嵌套使用的。</p><p>#include &lt;python.h&gt;</p><p>class PyThreadStateLock<br />{<br />public:<br />&nbsp;&nbsp;&nbsp; PyThreadStateLock(void)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state = PyGILState_Ensure( );<br />&nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp; ~PyThreadStateLock(void)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PyGILState_Release( state );<br />&nbsp;&nbsp;&nbsp; }<br />private:<br />&nbsp;&nbsp;&nbsp; PyGILState_STATE state;<br />};</p><p><br />二、在主线程中，这样处理</p><p>&nbsp;&nbsp;&nbsp; // 初始化<br />&nbsp;&nbsp;&nbsp; Py_Initialize();<br />&nbsp;&nbsp;&nbsp; // 初始化线程支持<br />&nbsp;&nbsp;&nbsp; PyEval_InitThreads();<br />&nbsp;&nbsp;&nbsp; // 启动子线程前执行，为了释放PyEval_InitThreads获得的全局锁，否则子线程可能无法获取到全局锁。<br />&nbsp;&nbsp;&nbsp; PyEval_ReleaseThread(PyThreadState_Get());<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; // 其他的处理，如启动子线程等<br />&nbsp;&nbsp;&nbsp; ......<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; // 保证子线程调用都结束后<br />&nbsp;&nbsp;&nbsp; PyGILState_Ensure();<br />&nbsp;&nbsp;&nbsp; Py_Finalize();<br />&nbsp;&nbsp;&nbsp; // 之后不能再调用任何python的API</p><p>三、在主线程，或者子线程中，调用python本身函数的都采用如下处理</p><p>&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class PyThreadStateLock PyThreadLock;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 调用python的API函数处理<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ......<br />&nbsp;&nbsp;&nbsp; }</p><p>呵呵，看这样是否非常简单了。</p><p><br />另外还有两个和全局锁有关的宏，Py_BEGIN_ALLOW_THREADS 和 Py_END_ALLOW_THREADS。这两个宏是为了在较长时间的C函数调用前，临时释放全局锁，完成后重新获取全局锁，以避免阻塞其他python的线程继续运行。这两个宏可以这样调用</p><p>&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class PyThreadStateLock PyThreadLock;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 调用python的API函数处理<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ......</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Py_BEGIN_ALLOW_THREADS<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 调用需要长时间的C函数<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ......<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Py_END_ALLOW_THREADS</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 调用python的API函数处理<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ......<br />&nbsp;&nbsp;&nbsp; }<br /><br /><strong>4. 可能的错误及解决</strong>&nbsp;<br />a. 在vs 200x 下 debug 模式出现链接问题&nbsp;<br />extmodule.obj : error LNK2019: unresolved external symbol __imp___Py_Dealloc referenced in function _PySwigObject_format<br />extmodule.obj : error LNK2019: unresolved external symbol __imp___Py_NegativeRefcount referenced in function _PySwigObject_format<br />extmodule.obj : error LNK2001: unresolved external symbol __imp___Py_RefTotal<br />extmodule.obj : error LNK2019: unresolved external symbol __imp___PyObject_DebugFree referenced in function _PySwigObject_dealloc<br />extmodule.obj : error LNK2019: unresolved external symbol __imp___PyObject_DebugMalloc referenced in function _PySwigObject_New<br />extmodule.obj : error LNK2019: unresolved external symbol __imp__Py_InitModule4TraceRefs referenced in function _init_extmodule<br /><br />主要是因为 Py_DEBUG/Py_TRACE_REFS 引起, 修改 Python\include 下的 pyconfig.h, object.h 两个文件就行了 ... 详见&nbsp;<a href="http://www.nabble.com/link-error-in-debug-mode-td3126668.html" style="color: #006ff7; font-size: 0.9em; ">http://www.nabble.com/link-error-in-debug-mode-td3126668.html</a>&nbsp;<br /></p></div><p class="postfoot" style="margin-top: 10px; border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted; border-right-width: 0px; border-left-width: 0px; border-top-width: 1px; border-bottom-width: 1px; border-top-color: #dfdfdf; border-right-color: #dfdfdf; border-bottom-color: #dfdfdf; border-left-color: #dfdfdf; padding-top: 6px; padding-bottom: 6px; color: #868686; ">posted on 2008-08-14 17:55&nbsp;<a href="http://www.cppblog.com/bigsml/" style="color: #006ff7; font-size: 0.9em; ">泡泡牛</a>&nbsp;阅读(4472)&nbsp;<a href="http://www.cppblog.com/bigsml/archive/2008/08/14/58859.html#Post" style="color: #006ff7; font-size: 0.9em; ">评论(3)</a>&nbsp;&nbsp;<a href="http://www.cppblog.com/bigsml/admin/EditPosts.aspx?postid=58859" style="color: #006ff7; font-size: 0.9em; ">编辑</a>&nbsp;<a href="http://www.cppblog.com/bigsml/AddToFavorite.aspx?id=58859" style="color: #006ff7; font-size: 0.9em; ">收藏</a>&nbsp;<a href="http://www.cppblog.com/bigsml/services/trackbacks/58859.aspx" style="color: #006ff7; font-size: 0.9em; ">引用</a>&nbsp;所属分类:&nbsp;<a href="http://www.cppblog.com/bigsml/category/7907.html" style="color: #006ff7; font-size: 0.9em; ">Python</a></p></div><img src="http://www.cppblog.com/bigsml/aggbug/58859.html?webview=1" width="1" height="1"  alt="" /><div id="AjaxHolder_UpdatePanel1"><a name="pagedcomment" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a><a name="评论" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a><div id="comments"><a name="评论"><h2 style="color: #7cc10b; font-size: 1em; margin-top: 16px; ">评论</h2></a><div class="CommentArea" style="margin-top: 8px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; "><a name="评论" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a><h4 class="CommentTitle" style="margin-bottom: 6px; font-size: 1em; "><a name="评论" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a><a title="permalink: re: 在 C++ 中使用 Python script " href="http://www.cppblog.com/bigsml/archive/2008/08/14/58859.html#58970" style="color: #006ff7; font-size: 0.9em; ">#</a>&nbsp;<a name="58970" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a>re: 在 C++ 中使用 Python script &nbsp;2008-08-15 20:34&nbsp;<a id="AjaxHolder_Comments_CommentList_ctl00_NameLink" href="http://www.cppblog.com/bigsml/" target="_blank" style="color: #006ff7; font-size: 0.9em; ">泡泡牛</a>&nbsp;<img src="http://www.cppblog.com/skins/Paperclip/images/spacer.gif" class="CommentArrow" style="background-image: url(http://www.cppblog.com/Skins/images/summer-comment-arrow.gif); width: 14px; height: 14px; margin-bottom: -7px; background-repeat: no-repeat no-repeat; "  alt="" /></h4><div class="CommentText" style="padding-bottom: 3px; background-image: url(http://www.cppblog.com/Skins/images/comment-shadow.gif); font-size: 0.9em; background-position: 0% 100%; background-repeat: repeat no-repeat; "><div class="CommentText2" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #bcbcbc; border-right-color: #bcbcbc; border-bottom-color: #bcbcbc; border-left-color: #bcbcbc; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; "><div class="CommentText3" style="padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 1em; ">谁知道有什么其他的可以在c++ 里面调用的script 引擎吗?</div></div></div><div class="CommentFooter" style="margin-top: 0px; font-size: 0.9em; color: #999999; ">&nbsp;&nbsp;<a href="http://www.cppblog.com/bigsml/archive/2008/08/14/58859.html#post" style="color: #006ff7; text-decoration: none; font-size: 0.9em; ">回复</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cppblog.com/comment?author=%e6%b3%a1%e6%b3%a1%e7%89%9b" target="_blank" style="color: #006ff7; text-decoration: none; font-size: 0.9em; ">更多评论</a>&nbsp;&nbsp;<a id="AjaxHolder_Comments_CommentList_ctl00_DeleteLink" href="http://www.cppblog.com/bigsml/archive/2008/08/14/58859.html" style="color: #006ff7; text-decoration: none; font-size: 0.9em; "></a>&nbsp;&nbsp;<a id="AjaxHolder_Comments_CommentList_ctl00_EditLink"></a></div></div><div class="CommentArea" style="margin-top: 8px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; "><h4 class="CommentTitle" style="margin-bottom: 6px; font-size: 1em; "><a title="permalink: re: 在 C++ 中使用 Python script " href="http://www.cppblog.com/bigsml/archive/2008/08/14/58859.html#62696" style="color: #006ff7; font-size: 0.9em; ">#</a>&nbsp;<a name="62696" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a>re: 在 C++ 中使用 Python script &nbsp;2008-09-24 20:10&nbsp;<a id="AjaxHolder_Comments_CommentList_ctl01_NameLink" target="_blank">sheena</a>&nbsp;<img src="http://www.cppblog.com/skins/Paperclip/images/spacer.gif" class="CommentArrow" style="background-image: url(http://www.cppblog.com/Skins/images/summer-comment-arrow.gif); width: 14px; height: 14px; margin-bottom: -7px; background-repeat: no-repeat no-repeat; "  alt="" /></h4><div class="CommentText" style="padding-bottom: 3px; background-image: url(http://www.cppblog.com/Skins/images/comment-shadow.gif); font-size: 0.9em; background-position: 0% 100%; background-repeat: repeat no-repeat; "><div class="CommentText2" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #bcbcbc; border-right-color: #bcbcbc; border-bottom-color: #bcbcbc; border-left-color: #bcbcbc; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; "><div class="CommentText3" style="padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 1em; ">主要是因为 Py_DEBUG/Py_TRACE_REFS 引起, 修改 Python\include 下的 pyconfig.h, object.h 两个文件就行了 ... 详见&nbsp;<a target="_new" href="http://www.nabble.com/link-error-in-debug-mode-td3126668.html" style="color: #006ff7; font-size: 0.9em; ">http://www.nabble.com/link-error-in-debug-mode-td3126668.html</a>&nbsp;<br />这个解释我还是没有看明白，？您能再解释下吗</div></div></div><div class="CommentFooter" style="margin-top: 0px; font-size: 0.9em; color: #999999; ">&nbsp;&nbsp;<a href="http://www.cppblog.com/bigsml/archive/2008/08/14/58859.html#post" style="color: #006ff7; text-decoration: none; font-size: 0.9em; ">回复</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cppblog.com/comment?author=sheena" target="_blank" style="color: #006ff7; text-decoration: none; font-size: 0.9em; ">更多评论</a>&nbsp;&nbsp;<a id="AjaxHolder_Comments_CommentList_ctl01_DeleteLink" href="http://www.cppblog.com/bigsml/archive/2008/08/14/58859.html" style="color: #006ff7; text-decoration: none; font-size: 0.9em; "></a>&nbsp;&nbsp;<a id="AjaxHolder_Comments_CommentList_ctl01_EditLink"></a></div></div><div class="CommentArea" style="margin-top: 8px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; "><h4 class="CommentTitle" style="margin-bottom: 6px; font-size: 1em; "><a title="permalink: re: 在 C++ 中使用 Python script " href="http://www.cppblog.com/bigsml/archive/2008/08/14/58859.html#62715" style="color: #006ff7; font-size: 0.9em; ">#</a>&nbsp;<a name="62715" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a>re: 在 C++ 中使用 Python script&nbsp;<a name="Post" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a>&nbsp;2008-09-24 22:17&nbsp;<a id="AjaxHolder_Comments_CommentList_ctl02_NameLink" href="http://www.cppblog.com/bigsml/" target="_blank" style="color: #006ff7; font-size: 0.9em; ">泡泡牛</a>&nbsp;<img src="http://www.cppblog.com/skins/Paperclip/images/spacer.gif" class="CommentArrow" style="background-image: url(http://www.cppblog.com/Skins/images/summer-comment-arrow.gif); width: 14px; height: 14px; margin-bottom: -7px; background-repeat: no-repeat no-repeat; "  alt="" /></h4><div class="CommentText" style="padding-bottom: 3px; background-image: url(http://www.cppblog.com/Skins/images/comment-shadow.gif); font-size: 0.9em; background-position: 0% 100%; background-repeat: repeat no-repeat; "><div class="CommentText2" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #bcbcbc; border-right-color: #bcbcbc; border-bottom-color: #bcbcbc; border-left-color: #bcbcbc; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; "><div class="CommentText3" style="padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 1em; ">1. 修改 pyconfig.h&nbsp;<br /><br />修改&nbsp;<br /><br />#ifdef _DEBUG&nbsp;<br /># define Py_DEBUG&nbsp;<br />#endif&nbsp;<br /><br />为&nbsp;<br /><br />#ifdef _DEBUG&nbsp;<br />//# define Py_DEBUG&nbsp;<br />#endif&nbsp;<br /><br />修改&nbsp;<br /><br /># ifdef _DEBUG&nbsp;<br /># pragma comment(lib,"python24_d.lib")&nbsp;<br /># else&nbsp;<br /># pragma comment(lib,"python24.lib")&nbsp;<br /># endif /* _DEBUG */&nbsp;<br /><br />为&nbsp;<br /><br /># ifdef _DEBUG&nbsp;<br /># pragma comment(lib,"python24.lib")&nbsp;<br /># else&nbsp;<br /># pragma comment(lib,"python24.lib")&nbsp;<br /># endif /* _DEBUG */&nbsp;<br /><br /><br />2. object.h&nbsp;<br />修改&nbsp;<br />#if defined(Py_DEBUG) &amp;&amp; !defined(Py_TRACE_REFS)&nbsp;<br />#define Py_TRACE_REFS&nbsp;<br />#endif&nbsp;<br /><br />为&nbsp;<br /><br />#if defined(Py_DEBUG) &amp;&amp; !defined(Py_TRACE_REFS)&nbsp;<br />// #define Py_TRACE_REFS&nbsp;<br />#endif</div></div></div></div></div></div></span><img src ="http://www.cppblog.com/lauer3912/aggbug/151962.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-07-28 07:24 <a href="http://www.cppblog.com/lauer3912/archive/2011/07/28/151962.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>简单的Copy文件到多个目录，可以指定，支持正则表达式</title><link>http://www.cppblog.com/lauer3912/archive/2011/06/21/149071.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 20 Jun 2011 16:47:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/06/21/149071.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/149071.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/06/21/149071.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/149071.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/149071.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080; ">&nbsp;&nbsp;1</span>&nbsp;<span style="color: #008000; ">#</span><span style="color: #008000; ">!/usr/bin/env&nbsp;python</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">&nbsp;&nbsp;2</span>&nbsp;<span style="color: #008000; ">#</span><span style="color: #008000; ">&nbsp;-*-&nbsp;coding:&nbsp;utf-8&nbsp;-*-</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">&nbsp;&nbsp;3</span>&nbsp;<span style="color: #008000; "></span><span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;&nbsp;4</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;&nbsp;5</span>&nbsp;<span style="color: #000000; "></span><span style="color: #008000; ">#</span><span style="color: #008000; ">&nbsp;Fast&nbsp;copy&nbsp;for&nbsp;Winodws&nbsp;or&nbsp;Linux</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">&nbsp;&nbsp;6</span>&nbsp;<span style="color: #008000; ">#</span><span style="color: #008000; ">&nbsp;Copy&nbsp;file&nbsp;to</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">&nbsp;&nbsp;7</span>&nbsp;<span style="color: #008000; "></span><span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;&nbsp;8</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; ">&nbsp;os<br /></span><span style="color: #008080; ">&nbsp;&nbsp;9</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; ">&nbsp;sys<br /></span><span style="color: #008080; ">&nbsp;10</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; ">&nbsp;re<br /></span><span style="color: #008080; ">&nbsp;11</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">from</span><span style="color: #000000; ">&nbsp;optparse&nbsp;</span><span style="color: #0000FF; ">import</span><span style="color: #000000; ">&nbsp;OptionParser<br /></span><span style="color: #008080; ">&nbsp;12</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;13</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;14</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">def</span><span style="color: #000000; ">&nbsp;CallFastCmd(src,&nbsp;dest):<br /></span><span style="color: #008080; ">&nbsp;15</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">XCOPY&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">+</span><span style="color: #000000; ">&nbsp;src&nbsp;</span><span style="color: #000000; ">+</span><span style="color: #800000; ">"</span><span style="color: #800000; ">&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">+</span><span style="color: #000000; ">&nbsp;dest<br /></span><span style="color: #008080; ">&nbsp;16</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">print</span><span style="color: #000000; ">&nbsp;u</span><span style="color: #800000; ">"</span><span style="color: #800000; ">命令行</span><span style="color: #800000; ">"</span><span style="color: #000000; ">+</span><span style="color: #000000; ">&nbsp;cmd<br /></span><span style="color: #008080; ">&nbsp;17</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;os.system(cmd)<br /></span><span style="color: #008080; ">&nbsp;18</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;19</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">def</span><span style="color: #000000; ">&nbsp;SplitStr(src,&nbsp;split):<br /></span><span style="color: #008080; ">&nbsp;20</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">&nbsp;src.split(split)<br /></span><span style="color: #008080; ">&nbsp;21</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;22</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;23</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;24</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">def</span><span style="color: #000000; ">&nbsp;IsCanCopy(path,&nbsp;include,&nbsp;exclude):<br /></span><span style="color: #008080; ">&nbsp;25</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;IsCan&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;False<br /></span><span style="color: #008080; ">&nbsp;26</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;split&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">|</span><span style="color: #800000; ">"</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;27</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;include&nbsp;</span><span style="color: #0000FF; ">is</span><span style="color: #000000; ">&nbsp;None:<br /></span><span style="color: #008080; ">&nbsp;28</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;exclude&nbsp;</span><span style="color: #0000FF; ">is</span><span style="color: #000000; ">&nbsp;None:<br /></span><span style="color: #008080; ">&nbsp;29</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IsCan&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;True<br /></span><span style="color: #008080; ">&nbsp;30</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">else</span><span style="color: #000000; ">:<br /></span><span style="color: #008080; ">&nbsp;31</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">&nbsp;excStr&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;SplitStr(exclude,&nbsp;split):<br /></span><span style="color: #008080; ">&nbsp;32</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;(excStr&nbsp;</span><span style="color: #0000FF; ">not</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;path):<br /></span><span style="color: #008080; ">&nbsp;33</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IsCan&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;True<br /></span><span style="color: #008080; ">&nbsp;34</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">else</span><span style="color: #000000; ">:<br /></span><span style="color: #008080; ">&nbsp;35</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">&nbsp;incStr&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;SplitStr(include,&nbsp;split):<br /></span><span style="color: #008080; ">&nbsp;36</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;37</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;exclude&nbsp;</span><span style="color: #0000FF; ">is</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">not</span><span style="color: #000000; ">&nbsp;None&nbsp;:<br /></span><span style="color: #008080; ">&nbsp;38</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">&nbsp;excStr&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;SplitStr(exclude,&nbsp;split):<br /></span><span style="color: #008080; ">&nbsp;39</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;(excStr&nbsp;</span><span style="color: #0000FF; ">not</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;path)&nbsp;</span><span style="color: #0000FF; ">and</span><span style="color: #000000; ">&nbsp;(incStr&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;path):<br /></span><span style="color: #008080; ">&nbsp;40</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IsCan&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;True<br /></span><span style="color: #008080; ">&nbsp;41</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">elif</span><span style="color: #000000; ">&nbsp;incStr&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;path:<br /></span><span style="color: #008080; ">&nbsp;42</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IsCan&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;True<br /></span><span style="color: #008080; ">&nbsp;43</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;44</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;45</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;46</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">#</span><span style="color: #008000; ">返回值</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">&nbsp;47</span>&nbsp;<span style="color: #008000; "></span><span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">&nbsp;IsCan<br /></span><span style="color: #008080; ">&nbsp;48</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;49</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;50</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;51</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">def</span><span style="color: #000000; ">&nbsp;CopyToSubDir(src,&nbsp;des,&nbsp;include,&nbsp;exclude,&nbsp;regEnable):<br /></span><span style="color: #008080; ">&nbsp;52</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">&nbsp;root,dirs,files&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;os.walk(des):<br /></span><span style="color: #008080; ">&nbsp;53</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">&nbsp;dirPath&nbsp;</span><span style="color: #0000FF; ">in</span><span style="color: #000000; ">&nbsp;dirs:<br /></span><span style="color: #008080; ">&nbsp;54</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subPath&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;os.path.join(root,dirPath)&nbsp;</span><span style="color: #008000; ">#</span><span style="color: #008000; ">&nbsp;路径</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">&nbsp;55</span>&nbsp;<span style="color: #008000; "></span><span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">not</span><span style="color: #000000; ">&nbsp;regEnable:<br /></span><span style="color: #008080; ">&nbsp;56</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;IsCanCopy(subPath,&nbsp;include,&nbsp;exclude):<br /></span><span style="color: #008080; ">&nbsp;57</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CallFastCmd(src,&nbsp;subPath)<br /></span><span style="color: #008080; ">&nbsp;58</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">else</span><span style="color: #000000; ">:&nbsp;</span><span style="color: #008000; ">#</span><span style="color: #008000; ">使用正则表达式</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">&nbsp;59</span>&nbsp;<span style="color: #008000; "></span><span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incReg&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;include<br /></span><span style="color: #008080; ">&nbsp;60</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;excReg&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;exclude<br /></span><span style="color: #008080; ">&nbsp;61</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;62</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incMatch&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;incReg.match(incReg,&nbsp;subPath)<br /></span><span style="color: #008080; ">&nbsp;63</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;incMatch&nbsp;</span><span style="color: #0000FF; ">is</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">not</span><span style="color: #000000; ">&nbsp;None:<br /></span><span style="color: #008080; ">&nbsp;64</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;excMatch&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;excReg.match(excReg,&nbsp;subPath)<br /></span><span style="color: #008080; ">&nbsp;65</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;excMatch&nbsp;</span><span style="color: #0000FF; ">is</span><span style="color: #000000; ">&nbsp;None:<br /></span><span style="color: #008080; ">&nbsp;66</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CallFastCmd(src,&nbsp;subPath)<br /></span><span style="color: #008080; ">&nbsp;67</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;68</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;69</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;70</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;71</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;72</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">def</span><span style="color: #000000; ">&nbsp;Copy(src,&nbsp;des,&nbsp;include,&nbsp;exclude&nbsp;,&nbsp;regEnable):<br /></span><span style="color: #008080; ">&nbsp;73</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">not</span><span style="color: #000000; ">&nbsp;os.path.exists(des):<br /></span><span style="color: #008080; ">&nbsp;74</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CallFastCmd(src,&nbsp;des)<br /></span><span style="color: #008080; ">&nbsp;75</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">else</span><span style="color: #000000; ">:<br /></span><span style="color: #008080; ">&nbsp;76</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CopyToSubDir(src,&nbsp;des,&nbsp;include,&nbsp;exclude,&nbsp;regEnable)<br /></span><span style="color: #008080; ">&nbsp;77</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;78</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;79</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;80</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">def</span><span style="color: #000000; ">&nbsp;ParseCmd():<br /></span><span style="color: #008080; ">&nbsp;81</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;parser&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;OptionParser()<br /></span><span style="color: #008080; ">&nbsp;82</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;parser.add_option(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">-s</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">--src</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;action</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">store</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;dest</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">src</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;help</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">input&nbsp;the&nbsp;Dir&nbsp;or&nbsp;file</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /></span><span style="color: #008080; ">&nbsp;83</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;parser.add_option(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">-d</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">--des</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;action</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">store</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;dest</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">des</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;help</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">input&nbsp;the&nbsp;Dir&nbsp;or&nbsp;file</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /></span><span style="color: #008080; ">&nbsp;84</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;parser.add_option(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">-i</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">--include</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,action</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">store</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;dest</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">include</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;help</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">input&nbsp;the&nbsp;include&nbsp;string</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /></span><span style="color: #008080; ">&nbsp;85</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;parser.add_option(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">-e</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">--exclude</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,action</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">store</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;dest</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">exclude</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;help</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">input&nbsp;the&nbsp;exclude&nbsp;string</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /></span><span style="color: #008080; ">&nbsp;86</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;parser.add_option(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">-r</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">--regEnable</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,action</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">store_true</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;dest</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">regEnable</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,&nbsp;default</span><span style="color: #000000; ">=</span><span style="color: #000000; ">False,&nbsp;help</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">input&nbsp;the&nbsp;exclude&nbsp;string</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /></span><span style="color: #008080; ">&nbsp;87</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;88</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;89</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;(options,&nbsp;args)&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;parser.parse_args()<br /></span><span style="color: #008080; ">&nbsp;90</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;options.src&nbsp;</span><span style="color: #0000FF; ">is</span><span style="color: #000000; ">&nbsp;None:<br /></span><span style="color: #008080; ">&nbsp;91</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parser.error(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">The&nbsp;source&nbsp;is&nbsp;none</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /></span><span style="color: #008080; ">&nbsp;92</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;options.des&nbsp;</span><span style="color: #0000FF; ">is</span><span style="color: #000000; ">&nbsp;None:<br /></span><span style="color: #008080; ">&nbsp;93</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parser.error(</span><span style="color: #800000; ">"</span><span style="color: #800000; ">The&nbsp;dest&nbsp;is&nbsp;none</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /></span><span style="color: #008080; ">&nbsp;94</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;95</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;Copy(options.src,&nbsp;options.des,&nbsp;options.include,&nbsp;options.exclude,&nbsp;options.regEnable)<br /></span><span style="color: #008080; ">&nbsp;96</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;97</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800080; ">__name__</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">==</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">__main__</span><span style="color: #800000; ">"</span><span style="color: #000000; ">:<br /></span><span style="color: #008080; ">&nbsp;98</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;ParseCmd()<br /></span><span style="color: #008080; ">&nbsp;99</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">100</span>&nbsp;<span style="color: #000000; "></span></div><img src ="http://www.cppblog.com/lauer3912/aggbug/149071.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-06-21 00:47 <a href="http://www.cppblog.com/lauer3912/archive/2011/06/21/149071.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PyQt 教程</title><link>http://www.cppblog.com/lauer3912/archive/2011/06/03/147990.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 02 Jun 2011 23:25:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/06/03/147990.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/147990.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/06/03/147990.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/147990.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/147990.html</trackback:ping><description><![CDATA[<div><a href="http://www.commandprompt.com/community/pyqt/">http://www.commandprompt.com/community/pyqt/</a></div><img src ="http://www.cppblog.com/lauer3912/aggbug/147990.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-06-03 07:25 <a href="http://www.cppblog.com/lauer3912/archive/2011/06/03/147990.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JetBrains PyCharm v1.2.1 键盘映射</title><link>http://www.cppblog.com/lauer3912/archive/2011/06/03/147989.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 02 Jun 2011 22:37:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/06/03/147989.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/147989.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/06/03/147989.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/147989.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/147989.html</trackback:ping><description><![CDATA[<div><span style="color: #444444; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; "><h2><a id="CategoryEntryList1_EntryStoryList_Entries_ctl06_TitleUrl" href="http://www.cppblog.com/lauer3912/archive/2011/05/08/145962.html" style="color: #223355; text-decoration: none; ">JetBrains PyCharm v1.2.1<br /><img src="http://www.cppblog.com/images/cppblog_com/lauer3912/快照13.png" width="1311" height="945" alt="" /><br /></a></h2></span></div><img src ="http://www.cppblog.com/lauer3912/aggbug/147989.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-06-03 06:37 <a href="http://www.cppblog.com/lauer3912/archive/2011/06/03/147989.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Python中的easy_install</title><link>http://www.cppblog.com/lauer3912/archive/2011/06/01/147808.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 31 May 2011 22:51:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/06/01/147808.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/147808.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/06/01/147808.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/147808.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/147808.html</trackback:ping><description><![CDATA[<div style="text-align: right;"><font class="Apple-style-span" face="Georgia"><span class="Apple-style-span" style="font-size: 12px; line-height: 20px;"><div><span style="font-family: Tahoma, Helvetica, Arial, 宋体, sans-serif; font-size: 13px; line-height: normal; "><h2 style="text-align: left;"><a href="http://www.sou5.cn/archives/527.html" rel="bookmark" style="text-decoration: none; color: #0044aa; ">Python中的easy_install</a></h2><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">Python中的<a href="http://peak.telecommunity.com/DevCenter/EasyInstall" target="_blank" style="text-decoration: none; color: #0044aa; ">easy_install</a>工具很爽，它的作用类似于Php中的pear，或者Ruby中的gem，或者Perl中的cpan。</p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">如果想使用easy_install工具，可能需要先安装<a href="http://pypi.python.org/pypi/setuptools" target="_blank" style="text-decoration: none; color: #0044aa; ">setuptools</a>，不过更酷的方法是使用<a href="http://peak.telecommunity.com/dist/ez_setup.py" target="_blank" style="text-decoration: none; color: #0044aa; ">ez_setup.py</a>脚本：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; "><div style="text-align: left;">wget -q http://peak.telecommunity.com/dist/ez_setup.py</div><div style="text-align: left;">python ez_setup.py</div></p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">安装完后，最好确保easy_install所在目录已经被加到PATH环境变量里:</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; "><div style="text-align: left;">Windows: C:\Python25\Scripts</div><div style="text-align: left;">Linux: /usr/local/bin</div></p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">比如说要安装Python的MySQL支持，可以执行如下命令，系统会自动在<a href="http://pypi.python.org/pypi/" target="_blank" style="text-decoration: none; color: #0044aa; ">pypi</a>网站列表里查找相关软件包：</p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">easy_install MySQL-python</p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">如果你在Windows+python2.5上执行如上命令的话，可能会出现如下错误：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; "><div style="text-align: left;">Processing MySQL-python-1.2.3c1.tar.gz</div><div style="text-align: left;">Running MySQL-python-1.2.3c1\setup.py -q bdist_egg &#8211;dist-dir c:\docume~1\&#8230;</div><div style="text-align: left;">\locals~1\temp\easy_install-fvvfve\MySQL-python-1.2.3c1\egg-dist-tmp-q9moxf</div><div style="text-align: left;">error: The system cannot find the file specified</div></p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">出现这类错误的原因是选错了版本，针对这个案列，我们可以显式指定软件包的版本号：</p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">easy_install &#8220;MySQL-python==1.2.2&#8243;</p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">通过easy_install安装软件，相关安装信息会保存到easy-install.pth文件里，路径类似如下形式：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; "><div style="text-align: left;">Windows：C:\Python25\Lib\site-packages\easy-install.pth</div><div style="text-align: left;">Linux：/usr/local/lib/python25/site-packages/easy-install.pth</div></p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">如果想删除通过easy_install安装的软件包，比如说：MySQL-python，可以执行命令：</p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">easy_install -m MySQL-python</p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">此操作会从easy-install.pth文件里把MySQL-python的相关信息抹去，剩下的egg文件，你可以手动删除。</p><p style="text-align: left;margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 20px; ">参考：http://www.ibm.com/developerworks/cn/linux/l-cppeak3.html</p></span></div></span></font></div><img src ="http://www.cppblog.com/lauer3912/aggbug/147808.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-06-01 06:51 <a href="http://www.cppblog.com/lauer3912/archive/2011/06/01/147808.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SQLObject 1.0.1 发布，Python的ORM框架</title><link>http://www.cppblog.com/lauer3912/archive/2011/05/31/147730.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 30 May 2011 23:12:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/05/31/147730.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/147730.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/05/31/147730.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/147730.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/147730.html</trackback:ping><description><![CDATA[<span style="font-family: Verdana, Simsun, sans-serif; font-size: 14px; line-height: 24px; "><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 5px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 0em; ">该版本修复了 SQLiteConnection 在语法上的不兼容导致 Python 2.4 无法使用 SQLObject 的问题。</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 5px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 0em; ">SQLObject 是一个流行的Python 数据库对象映射框架，映射的规则就是表-&gt;类、字段-&gt;属性</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 5px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 0em; ">示例代码：</p><pre style="padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; font-size: 9pt; font-family: 'Courier New', Arial; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f6f6f6; background-position: initial initial; background-repeat: initial initial; ">&gt;&gt;&gt; from sqlobject import *<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&gt;&gt;&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&gt;&gt;&gt; sqlhub.processConnection = connectionForURI('sqlite:/:memory:')<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&gt;&gt;&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&gt;&gt;&gt; class Person(SQLObject):<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />...     fname = StringCol()<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />...     mi = StringCol(length=1, default=None)<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />...     lname = StringCol()<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />...<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&gt;&gt;&gt; Person.createTable()</pre></span><img src ="http://www.cppblog.com/lauer3912/aggbug/147730.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-05-31 07:12 <a href="http://www.cppblog.com/lauer3912/archive/2011/05/31/147730.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mxDateTime 3.2.0 发布，python模块</title><link>http://www.cppblog.com/lauer3912/archive/2011/05/24/147004.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 23 May 2011 21:46:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/05/24/147004.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/147004.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/05/24/147004.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/147004.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/147004.html</trackback:ping><description><![CDATA[<span style="font-family: Verdana, Simsun, sans-serif; font-size: 13px; "><div id="OSChina_News_18206" textcontent=""  newstype1"="" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 24px; color: #000000; font-size: 10.5pt; overflow-x: hidden; overflow-y: hidden; "><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 5px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 0em; ">mxDateTime 是个Python模块，用来做复杂的日期/时间功能。</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 5px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 0em; ">mxDateTime 3.2.0 稳定版发布，该版本变化如下：</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 5px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 0em; ">增加对Python 2.7 的支持；增加Native Windows x64 的支持；增加新的mx.Misc.Daemon模块；增加easy_install支持；增加代码清理等。</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 5px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 0em; ">mxDateTime是采用BSD许可的开源项目，更多文档见<a href="http://www.egenix.com/products/python/mxBase/mxDateTime/doc/" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.egenix.com/products/python/mxBase/mxDateTime/doc/</a>。</p></div><div style="padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 10px; margin-top: 20px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeffee; text-align: left; color: #666666; font-size: 10pt; line-height: 22px; border-left-width: 10px; border-left-style: solid; border-left-color: #ccffcc; background-position: initial initial; background-repeat: initial initial; ">本站文章除注明转载外，均为本站原创或编译<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />欢迎任何形式的转载，但请务必注明出处，尊重他人劳动共创开源社区<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />转载请注明：文章转载自：<strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">开源中国社区</strong>&nbsp;[<a href="http://www.oschina.net/" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #333333; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.oschina.net</a>]<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />本文标题：mxDateTime 3.2.0 发布，python模块<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />本文地址：<a href="http://www.oschina.net/news/18206/mxdatetime-3-2-0-python" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #333333; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.oschina.net/news/18206/mxdatetime-3-2-0-python<br /><br /><br /></a></div></span><img src ="http://www.cppblog.com/lauer3912/aggbug/147004.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-05-24 05:46 <a href="http://www.cppblog.com/lauer3912/archive/2011/05/24/147004.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Python XML</title><link>http://www.cppblog.com/lauer3912/archive/2011/05/22/146942.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sun, 22 May 2011 13:34:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/05/22/146942.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/146942.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/05/22/146942.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/146942.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/146942.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: URL= http://woodpecker.org.cn/diveintopython3/xml.html     你的位置: Home  &#8227; Dive  Into Python 3 &#8227;  难度等级: &#9830;&#9830;&#9830;&#9830;&#9826;  XML  ❝ In the archonship of Aristaechmus, Draco e...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2011/05/22/146942.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/146942.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-05-22 21:34 <a href="http://www.cppblog.com/lauer3912/archive/2011/05/22/146942.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用PyQt 制作简单的启动界面的例子代码</title><link>http://www.cppblog.com/lauer3912/archive/2011/05/18/146611.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 17 May 2011 23:37:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/05/18/146611.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/146611.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/05/18/146611.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/146611.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/146611.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->&nbsp;&nbsp;1#!/usr/bin/env&nbsp;python&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4########################...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2011/05/18/146611.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/146611.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-05-18 07:37 <a href="http://www.cppblog.com/lauer3912/archive/2011/05/18/146611.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Python 有用的网站</title><link>http://www.cppblog.com/lauer3912/archive/2011/05/09/145994.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sun, 08 May 2011 23:35:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/05/09/145994.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/145994.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/05/09/145994.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/145994.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/145994.html</trackback:ping><description><![CDATA[<span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; border-collapse: separate; font: medium 'comic sans ms', fantasy; white-space: normal; orphans: 2; color: #000000; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span"><span style="font-family: 'comic sans ms', fantasy; font-size: 13px; "><h1>如何成为 Python 高手</h1><div style="font-family: 'comic sans ms', fantasy !important; padding-bottom: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dddddd; color: #666666; "><span style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; float: right; "><em id="p_attention_count" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">83</em>人关注此资讯，&nbsp;<span id="attention_it" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.oschina.net/news/19085/how-to-become-a-proficient-python-programmer" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">我要关注(收藏)</a>(<a href="http://www.oschina.net/help/favorite?modal=true&amp;height=300" title="什么是关注" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">?</a>)&nbsp;</span>|&nbsp;<a href="http://www.oschina.net/home/go?page=admin%2Fnew-release" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">新闻投递</a></span><a href="http://my.oschina.net/javayou" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">红薯</a>&nbsp;发布于： 2011年06月23日 (<a href="http://www.oschina.net/news/19085/how-to-become-a-proficient-python-programmer#comments" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">17评</a>)</div><div id="OSChina_News_19085" textcontent=""  newstype2"="" style="font-family: 'comic sans ms', fantasy !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 24px; color: #000000; font-size: 10.5pt; overflow-x: hidden; overflow-y: hidden; "><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">本文是从&nbsp;<a href="http://blog.dispatched.ch/2011/06/12/how-to-become-a-proficient-python-programmer/" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">How to become a proficient Python programmer</a>&nbsp;这篇文章翻译而来。</p><hr style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">这篇文章主要是对我收集的一些文章的摘要。因为已经有很多比我有才华的人写出了大量关于如何成为优秀Python程序员的好文章。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">我的总结主要集中在四个基本题目上：函数式编程，性能，测试，编码规范。如果一个程序员能将这四个方面的内容知识都吸收消化，那他/她不管怎样都会有巨大的收获。</p><h3>函数式编程</h3><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">命令式的编程风格已经成为事实上的标准。命令式编程的程序是由一些描述状态转变的语句组成。虽然有时候这种编程方式十分的有效，但有时也不尽如此(比如复杂性) &#8212;&#8212; 而且，相对于声明式编程方式，它可能会显得不是很直观。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">如果你不明白我究竟是在说什么，这很正常。这里有一些文章能让你脑袋开窍。但你要注意，这些文章有点像《骇客帝国》里的红色药丸 &#8212;&#8212; 一旦你尝试过了函数式编程，你就永远不会回头了。</p><ul style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; list-style-type: disc; list-style-position: inside; "><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.amk.ca/python/writing/functional" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.amk.ca/python/writing/functional</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.secnetix.de/olli/Python/lambda_functions.hawk" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.secnetix.de/olli/Python/lambda_functions.hawk</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://docs.python.org/howto/functional.html" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://docs.python.org/howto/functional.html</a></li></ul><h3>性能</h3><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">你会看到有如此多的讨论都在批评这些&#8220;脚本语言&#8221;(Python，Ruby)是如何的性能低下，可是你却经常的容易忽略这样的事实：是程序员使用的算法导致了程序这样拙劣的表现。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">这里有一些非常好的文章，能让你知道Python的运行时性能表现的细节详情，你会发现，通过这些精炼而且有趣的语言，你也能写出高性能的应用程 序。而且，当你的老板质疑Python的性能时，你别忘了告诉他，这世界上第二大的搜索引擎就是用Python写成的 &#8212;&#8212; 它叫做Youtube(参考<a href="http://www.python.org/about/quotes/" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">Python摘录</a>)</p><ul style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; list-style-type: disc; list-style-position: inside; "><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://jaynes.colorado.edu/PythonIdioms.html" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://jaynes.colorado.edu/PythonIdioms.html</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://wiki.python.org/moin/PythonSpeed/PerformanceTips" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://wiki.python.org/moin/PythonSpeed/PerformanceTips</a></li></ul><h3>测试</h3><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">如今在计算机科学界，测试可能是一个最让人不知所措的主题了。有些程序员能真正的理解它，十分重视TDD(测试驱动开发)和它的后继者BDD(行为 驱动开发)。而另外一些根本不接受，认为这是浪费时间。那么，我现在将告诉你：如果你不曾开始使用TDD/BDD，那你错过了很多最好的东西！</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">这并不只是说引入了一种技术，可以替换你的公司里那种通过愚蠢的手工点击测试应用程序的原始发布管理制度，更重要的是，它是一种能够让你深入理解你 自己的业务领域的工具 &#8212;&#8212; 真正的你需要的、你想要的攻克问题、处理问题的方式。如果你还没有这样做，请试一下。下面的这些文章将会给你一些提示：</p><ul style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; list-style-type: disc; list-style-position: inside; "><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.oreillynet.com/lpt/a/5463" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.oreillynet.com/lpt/a/5463</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.oreillynet.com/lpt/a/5584" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.oreillynet.com/lpt/a/5584</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://wiki.cacr.caltech.edu/danse/index.php/Unit_testing_and_Integration_testing" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://wiki.cacr.caltech.edu/danse/index.php/Unit_testing_and_Integration_testing</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://docs.python.org/library/unittest.html" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://docs.python.org/library/unittest.html</a></li></ul><h3>编码规范</h3><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">并非所有的代码生来平等。有些代码可以被另外的任何一个好的程序员读懂和修改。但有些却只能被读，而且只能被代码的原始作者修改 &#8212;&#8212; 而且这也只是在他或她写出了这代码的几小时内可以。为什么会这样？因为没有经过代码测试(上面说的)和缺乏正确的编程规范。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">下面的文章给你描述了一个最小的应该遵守的规范合集。如果按照这些指导原则，你将能编写出更简洁和漂亮的代码。作为附加效应，你的程序会变得可读性更好，更容易的被你和任何其他人修改。</p><ul style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; list-style-type: disc; list-style-position: inside; "><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.python.org/dev/peps/pep-0008/" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.python.org/dev/peps/pep-0008/</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.fantascienza.net/leonardo/ar/python_best_practices.html" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.fantascienza.net/leonardo/ar/python_best_practices.html</a></li></ul><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">那就去传阅这这些资料吧。从坐在你身边的人开始。也许在下一次程序员沙龙或编程大会的时候，也已经成为一名Python编程高手了！</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">祝你学习旅途顺利。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">如果你喜欢这些文章，请在微博上顶一下，让其他人也知道。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 0em; font-weight: bold; color: #aa0000; ">更多关于<a href="http://www.oschina.net/p/python" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 3px; margin-bottom: 0px; margin-left: 3px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">Python</a>的详细信息，或者下载地址请点<a href="http://www.oschina.net/action/project/go?id=968&amp;p=download" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 3px; margin-bottom: 0px; margin-left: 3px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">这里</a></p></div><div style="font-family: 'comic sans ms', fantasy !important; padding-top: 3px; padding-bottom: 3px; padding-left: 10px; margin-top: 20px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeffee; text-align: left; color: #666666; font-size: 10pt; line-height: 22px; border-left-width: 10px; border-left-style: solid; border-left-color: #ccffcc; ">本文转载自: 外刊IT评论&nbsp;<a href="http://www.aqee.net/" rel="nofollow" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #333333; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.aqee.net/</a>&nbsp;</div></span></span><span class="Apple-style-span" style="color: #666666; font-family: 'comic sans ms', fantasy; font-size: 13px; line-height: 22px; background-color: #eeffee; "><a href="http://www.oschina.net/news/19085/how-to-become-a-proficient-python-programmer" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">收藏此资讯</a></span><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; border-collapse: separate; font: medium 'comic sans ms', fantasy; white-space: normal; orphans: 2; color: #000000; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span">Python 俱乐部<br /><a href="http://www.pythonclub.org/"><font color="#0066cc" size="3">http://www.pythonclub.org/<br /><br /><div><span style="color: #222222; font-family: 'Book Antiqua', Georgia, Palatino, Times, 'Times New Roman', serif; line-height: 23px; "><h1>深入 Python :Dive Into Python 中文版</h1></span></div></font></a><font color="#0066cc" size="3"><div><a href="http://www.pythonclub.org/"></a><a href="http://woodpecker.org.cn/diveintopython/index.html">http://woodpecker.org.cn/diveintopython/index.html</a></div><br /></font></span><span class="Apple-style-span" style="font-family: 'comic sans ms', fantasy; font-size: 13px; line-height: normal; background-color: #ffffff; "><h1 style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 15px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; font-size: 18pt; text-align: center; ">如何成为 Python 高手</h1><div class="pubDate" style="font-family: 'comic sans ms', fantasy !important; padding-bottom: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dddddd; color: #666666; "><span class="opts" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; float: right; "><em id="p_attention_count" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">83</em>人关注此资讯，&nbsp;<span id="attention_it" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.oschina.net/news/19085/how-to-become-a-proficient-python-programmer" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">我要关注(收藏)</a>(<a href="http://www.oschina.net/help/favorite?modal=true&amp;height=300" title="什么是关注" class="thickbox" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">?</a>)&nbsp;</span>|&nbsp;<a href="http://www.oschina.net/home/go?page=admin%2Fnew-release" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">新闻投递</a></span><a href="http://my.oschina.net/javayou" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">红薯</a>&nbsp;发布于： 2011年06月23日 (<a href="http://www.oschina.net/news/19085/how-to-become-a-proficient-python-programmer#comments" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">17评</a>)</div><div id="OSChina_News_19085" class="NewsContent TextContent NewsType2" style="font-family: 'comic sans ms', fantasy !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 24px; color: #000000; font-size: 10.5pt; overflow-x: hidden; overflow-y: hidden; "><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">本文是从&nbsp;<a href="http://blog.dispatched.ch/2011/06/12/how-to-become-a-proficient-python-programmer/" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">How to become a proficient Python programmer</a>&nbsp;这篇文章翻译而来。</p><hr style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">这篇文章主要是对我收集的一些文章的摘要。因为已经有很多比我有才华的人写出了大量关于如何成为优秀Python程序员的好文章。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">我的总结主要集中在四个基本题目上：函数式编程，性能，测试，编码规范。如果一个程序员能将这四个方面的内容知识都吸收消化，那他/她不管怎样都会有巨大的收获。</p><h3 style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">函数式编程</h3><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">命令式的编程风格已经成为事实上的标准。命令式编程的程序是由一些描述状态转变的语句组成。虽然有时候这种编程方式十分的有效，但有时也不尽如此(比如复杂性) &#8212;&#8212; 而且，相对于声明式编程方式，它可能会显得不是很直观。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">如果你不明白我究竟是在说什么，这很正常。这里有一些文章能让你脑袋开窍。但你要注意，这些文章有点像《骇客帝国》里的红色药丸 &#8212;&#8212; 一旦你尝试过了函数式编程，你就永远不会回头了。</p><ul style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; list-style-type: disc; list-style-position: inside; "><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.amk.ca/python/writing/functional" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.amk.ca/python/writing/functional</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.secnetix.de/olli/Python/lambda_functions.hawk" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.secnetix.de/olli/Python/lambda_functions.hawk</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://docs.python.org/howto/functional.html" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://docs.python.org/howto/functional.html</a></li></ul><h3 style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">性能</h3><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">你会看到有如此多的讨论都在批评这些&#8220;脚本语言&#8221;(Python，Ruby)是如何的性能低下，可是你却经常的容易忽略这样的事实：是程序员使用的算法导致了程序这样拙劣的表现。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">这里有一些非常好的文章，能让你知道Python的运行时性能表现的细节详情，你会发现，通过这些精炼而且有趣的语言，你也能写出高性能的应用程 序。而且，当你的老板质疑Python的性能时，你别忘了告诉他，这世界上第二大的搜索引擎就是用Python写成的 &#8212;&#8212; 它叫做Youtube(参考<a href="http://www.python.org/about/quotes/" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">Python摘录</a>)</p><ul style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; list-style-type: disc; list-style-position: inside; "><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://jaynes.colorado.edu/PythonIdioms.html" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://jaynes.colorado.edu/PythonIdioms.html</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://wiki.python.org/moin/PythonSpeed/PerformanceTips" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://wiki.python.org/moin/PythonSpeed/PerformanceTips</a></li></ul><h3 style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">测试</h3><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">如今在计算机科学界，测试可能是一个最让人不知所措的主题了。有些程序员能真正的理解它，十分重视TDD(测试驱动开发)和它的后继者BDD(行为 驱动开发)。而另外一些根本不接受，认为这是浪费时间。那么，我现在将告诉你：如果你不曾开始使用TDD/BDD，那你错过了很多最好的东西！</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">这并不只是说引入了一种技术，可以替换你的公司里那种通过愚蠢的手工点击测试应用程序的原始发布管理制度，更重要的是，它是一种能够让你深入理解你 自己的业务领域的工具 &#8212;&#8212; 真正的你需要的、你想要的攻克问题、处理问题的方式。如果你还没有这样做，请试一下。下面的这些文章将会给你一些提示：</p><ul style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; list-style-type: disc; list-style-position: inside; "><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.oreillynet.com/lpt/a/5463" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.oreillynet.com/lpt/a/5463</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.oreillynet.com/lpt/a/5584" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.oreillynet.com/lpt/a/5584</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://wiki.cacr.caltech.edu/danse/index.php/Unit_testing_and_Integration_testing" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://wiki.cacr.caltech.edu/danse/index.php/Unit_testing_and_Integration_testing</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://docs.python.org/library/unittest.html" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://docs.python.org/library/unittest.html</a></li></ul><h3 style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">编码规范</h3><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">并非所有的代码生来平等。有些代码可以被另外的任何一个好的程序员读懂和修改。但有些却只能被读，而且只能被代码的原始作者修改 &#8212;&#8212; 而且这也只是在他或她写出了这代码的几小时内可以。为什么会这样？因为没有经过代码测试(上面说的)和缺乏正确的编程规范。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">下面的文章给你描述了一个最小的应该遵守的规范合集。如果按照这些指导原则，你将能编写出更简洁和漂亮的代码。作为附加效应，你的程序会变得可读性更好，更容易的被你和任何其他人修改。</p><ul style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; list-style-type: disc; list-style-position: inside; "><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.python.org/dev/peps/pep-0008/" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.python.org/dev/peps/pep-0008/</a></li><li style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.fantascienza.net/leonardo/ar/python_best_practices.html" target="_blank" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.fantascienza.net/leonardo/ar/python_best_practices.html</a></li></ul><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">那就去传阅这这些资料吧。从坐在你身边的人开始。也许在下一次程序员沙龙或编程大会的时候，也已经成为一名Python编程高手了！</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">祝你学习旅途顺利。</p><p style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">如果你喜欢这些文章，请在微博上顶一下，让其他人也知道。</p><p class="ProjectOfNews" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 0em; font-weight: bold; color: #aa0000; ">更多关于<a href="http://www.oschina.net/p/python" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 3px; margin-bottom: 0px; margin-left: 3px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">Python</a>的详细信息，或者下载地址请点<a href="http://www.oschina.net/action/project/go?id=968&amp;p=download" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 3px; margin-bottom: 0px; margin-left: 3px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">这里</a></p></div><div class="copyright" style="font-family: 'comic sans ms', fantasy !important; padding-top: 3px; padding-bottom: 3px; padding-left: 10px; margin-top: 20px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeffee; text-align: left; color: #666666; font-size: 10pt; line-height: 22px; border-left-width: 10px; border-left-style: solid; border-left-color: #ccffcc; ">本文转载自: 外刊IT评论&nbsp;<a href="http://www.aqee.net/" rel="nofollow" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #333333; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.aqee.net/</a>&nbsp;<br style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /><span id="attention_it2" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.oschina.net/news/19085/how-to-become-a-proficient-python-programmer" style="font-family: 'comic sans ms', fantasy !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">收藏此资讯</a></span></div></span><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; border-collapse: separate; font: medium 'comic sans ms', fantasy; white-space: normal; orphans: 2; color: #000000; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span"><font color="#0066cc" size="3"><br /></font><br /><br /></span><img src ="http://www.cppblog.com/lauer3912/aggbug/145994.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-05-09 07:35 <a href="http://www.cppblog.com/lauer3912/archive/2011/05/09/145994.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>《高效Python/Django开发工具》(JetBrains PyCharm)v1.2.1</title><link>http://www.cppblog.com/lauer3912/archive/2011/05/08/145962.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sun, 08 May 2011 10:08:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/05/08/145962.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/145962.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/05/08/145962.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/145962.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/145962.html</trackback:ping><description><![CDATA[<div id="iptcomCname" class="iptcom"><span class="iptcom-title"><strong>中文名</strong>: </span>高效Python/Django开发工具</div>
<div id="iptcomEname" class="iptcom"><span class="iptcom-title"><strong>英文名</strong>: </span>JetBrains PyCharm</div>
<div id="iptcomFiletype" class="iptcom"><span class="iptcom-title"><strong>资源格式</strong>: </span>压缩包</div>
<div id="iptcomVersion" class="iptcom"><span class="iptcom-title"><strong>版本</strong>: </span>v1.2.1</div>
<div id="iptcomTime" class="iptcom"><span class="iptcom-title"><strong>发行时间</strong>: </span>2011年</div>
<div id="iptcomCompany" class="iptcom-multiline"><span class="iptcom-title"><strong>制作发行</strong>: </span><span class="iptcom-info">JetBrains</span></div>
<div id="iptcomLanguageWriting" class="iptcom"><span class="iptcom-title"><strong>语言</strong>: </span><a href="http://www.verycd.com/search/lang/english" target="_blank"><u>英文</u></a></div>
<div id="iptcomContents" class="iptcom"><span class="iptcom-title"><strong>简介</strong>: </span><br /><!--wrap-head begin-->
<p class="inner_content"><!--wrap-head end--><span class="post_origin_img" originlink="http://image-7.VeryCD.com/19900ed088c8c2266ca545aa28ec0ce127706/2u7n0qx.png"><a href="http://image-7.verycd.com/19900ed088c8c2266ca545aa28ec0ce127706/2u7n0qx.png" target="_blank"><img border="0" name="post_img" alt="IPB Image" src="http://image-7.verycd.com/19900ed088c8c2266ca545aa28ec0ce127706(600x)/thumb.jpg" /></a></span><br /><br /><br />PyCharm是由JetBrains打造的一款Python IDE。PyCharm具备一般IDE的功能，比如， 调试、语法高亮、Project管理、代码跳转、智能提示、自动完成、单元测试、版本控制&#8230;&#8230;<br />另外，PyCharm还提供了一些很好的功能用于Django开发，同时支持Google App Engine，更酷的是，PyCharm支持IronPython！<br /><br />特性：<br />智能编辑：为Python提供代码完成，快速切换语法，错误代码高亮显示和代码检查；<br />代码重构：包括重命名，引入变量，不断引进，拉，推下来，其他人；<br />使用Django进行Web开发：支持特定的模板编辑，服务器从IDE的启动，对HTML，CSS和JavaScript编辑的支持；<br />项目和代码导航：项目查看，文件结构查看，在文件，类，方法间快速跳转；<br />Error-Free编码：快速进行代码分析，错误高亮显示和快速修复；<br />集成VCS：支持Subversion, Perforce, Git以及CVS 等；<br />跨平台：支持Windows，Mac OS X和Linux操作系统<br /><br /><br /><!--c1-->
</p><div class="codetop">代码</div>
<div class="codemain"><!--ec1-->. ' <br />.: <br />` :: <br />: `: <br />' `.<br />/ \<br />.' `.<br />. -- . . . -- .<br />. `. _ _ .' .<br />`._ _.' \( . )/ `._ _.'<br />/ `_ . _' \<br />:: \ : / ::<br />:::: `. . . | . . . .' ::::<br />::: :::: ```` |\ _ __.i| S!._ /| '''' :::: :::<br />:::... | \__________. .__________/ | ...:::<br />:::::: | | | | ::::::<br />:: _. | | | | ._ ::<br />. _ __\| | _______.' `._______ | |/__ _ .<br />._________ |_ |____. . . .____| _| _________.<br />_| \| | | |/ |_<br />. \| " | | " |/ .<br />. _.i(\ \ ' | | ' / /)i._ .<br />"""______|\ ' ` . /|______"""<br />| "|_\ E M B R A C E . /_|" |<br />___| ____ _ _ ____________ i |___<br />' | | |/ "| | `<br />! ! ._____________ ' ! <br />_____________ ______ _______________/ /________________ __________<br />_______// | _______ /_______ /_____ ______/ _______/<br />/ . |/ _| _/_ _/ _/ _ | /<br />_____/ /| " . \_ | \ ' | `.__ _____/<br />_______________/ |____/|_____| |____|\____________________//_____________<br />. ___ /_____________________| . . . <br />| \ / . ' | .___.' | <br />. ___|_ \/ |__________.| _ __| `S! _|___ .<br />|/ ._ `.______________. `. \|<br />/ |___ _ . \<br />/. : .\<br />/_|____________ .______..-' _|_\<br />|____________|____________ ____________|____________|<br />| | | |<br />|____________|___________|____________|<br />. |<br />|__________i|<br />. .<br />: |<br />| _i|<br />_ |_____..i|_||<br />`'-. "``-.!<br />` '<br />P r o u d l y . P r e s e n t s . .<br />. _<br />_________________________|( \.-.___________`-.___ _ ___________<br />| |<br />| JetBrains PyCharm v1.2 |<br />| (c) JetBrains |<br />| date : 15 Mar, 2o11 size : 14 disks/5.00 MB |<br />| os : WinAll language : English |<br />| type : Development |<br />| protection : RSA-512 |<br />|_____________________________________________________________. |<br />______________________________________________________<br />: | .' :<br />._ | |__________________________________________________. | _.<br />|/ | | \|<br />&lt; __ [ r e l e a s e . i n f o ] __ &gt;<br />\ | | /<br />\ | JetBrains PyCharm - Python IDE with complete set of tools | /<br />\| for productive development with Python programming |/<br />` language. '<br />. In addition, the IDE provides high-class capabilities for .<br />: professional Web development with Django framework. :<br />| |<br />| Coding Assistance |<br />| |<br />| Code faster and with more pleasure in a smart and |<br />| configurable editor with code completion, snippets and |<br />| various intention actions |<br />| Code Analysis |<br />| |<br />| Take advantage of on-the-fly code syntax, error |<br />| highlighting, intelligent inspections and one-click quick- |<br />| fix suggestions to make code better |<br />| Project Code Navigation |<br />| |<br />| Instantly navigate from one file to another, from method to |<br />| its declaration or usages, and through classes hierarchy. |<br />| Learn keyboard shortcuts to be even more productive |<br />| Python Refactoring |<br />| |<br />| Make project-wide code changes painlessly with rename, |<br />| extract method, introduce field/variable/constant and pull |<br />| up/push down refactorings |<br />| Web Development with Django |<br />| |<br />| Even more rapid Web development with Django framework |<br />| backed up with excellent HTML, CSS and JavaScript editing |<br />| facilities |<br />| Google App Engine Support |<br />| |<br />| Develop applications for Google App Engine and delegate |<br />| routine deployment tasks to the IDE |<br />| |<br />| |<br />| INSTALL NOTES: |<br />| |<br />| Use the included Keymaker to register... |<br />| __|__ __<br />|_ E n j o y . . . /\ \\ `<br />|_|_____________________________________________________ __/ \____\\<br />)/\ \ / /<br />:::::::::::::::: [ g r o u p . i n f o ] ::::::::::: " \_\/____/<br />_ ____________________________________________________ _ / /\<br />|_| /____/ \<br />| It is 2010, and we are still here, almost 10 years `" \ /<br />| old. We strive to bring you quality above all else, .____\/<br />| and hope to inspire other groups to do the same. |<br />| |<br />| Let us set an example, and motivate future generations |<br />| to learn reverse engineering, and join the scene. |<br />__ __|__ |<br />' // /\ We hope that, with your help, we can continue to |<br />//____/ \__ tackle every protection. |<br />\ \ / / |<br />\____\/_/ Contact information: contact-emb@qq.com |<br />/\ \ . |<br />/ \____\ E M B R A C E .:: |<br />\ / "' established in October 2000 . .: .:::: |<br />\/____. _ _______________________ ______________________________|<br />__/ /_<br />[ g r e e |_ __/ i n g s ]<br />i.___________________________/ /_______________________________.i<br />| |<br />| |<br />| SSG TMG ECLiPSE ZWT AGAiN SHOCK LND CAFE DAMN TNO BAT |<br />: ACME ADDICTION NULL DI AiR :<br />. .<br />. ... and to all our old members: may you one day find .<br />' | your way back to us! ... | `<br />i | | i<br />__| |_ From the sky we will rise and conquer like we did so _| |___<br />/\ __ many times before, we will show the spirit of .. __ /\<br />/ \__/\ ....... /\__/ \<br />\ / \ `:::' .. / \ /<br />\/_ \ :::::: ::. ` .:: :::::: `: :: :::::: / _\/<br />/ \___ _ : ...: : `:' : : ...:. : : : _ ___/ \<br />\ / :..... : :. .: : :.....: : :....: \ /<br />\ / `:' \ /<br />\ / :. .: E M B R A C E ! \ /<br />\/__ _ `:' _ __\/<!--c2--></div>
<!--ec2--><br /><br /><!--c1-->
<div class="codetop">代码</div>
<div class="codemain"><!--ec1-->. ' <br />.: <br />` :: <br />: `: <br />' `.<br />/ \<br />.' `.<br />. -- . . . -- .<br />. `. _ _ .' .<br />`._ _.' \( . )/ `._ _.'<br />/ `_ . _' \<br />:: \ : / ::<br />:::: `. . . | . . . .' ::::<br />::: :::: ```` |\ _ __.i| S!._ /| '''' :::: :::<br />:::... | \__________. .__________/ | ...:::<br />:::::: | | | | ::::::<br />:: _. | | | | ._ ::<br />. _ __\| | _______.' `._______ | |/__ _ .<br />._________ |_ |____. . . .____| _| _________.<br />_| \| | | |/ |_<br />. \| " | | " |/ .<br />. _.i(\ \ ' | | ' / /)i._ .<br />"""______|\ ' ` . /|______"""<br />| "|_\ E M B R A C E . /_|" |<br />___| ____ _ _ ____________ i |___<br />' | | |/ "| | `<br />! ! ._____________ ' ! <br />_____________ ______ _______________/ /________________ __________<br />_______// | _______ /_______ /_____ ______/ _______/<br />/ . |/ _| _/_ _/ _/ _ | /<br />_____/ /| " . \_ | \ ' | `.__ _____/<br />_______________/ |____/|_____| |____|\____________________//_____________<br />. ___ /_____________________| . . . <br />| \ / . ' | .___.' | <br />. ___|_ \/ |__________.| _ __| `S! _|___ .<br />|/ ._ `.______________. `. \|<br />/ |___ _ . \<br />/. : .\<br />/_|____________ .______..-' _|_\<br />|____________|____________ ____________|____________|<br />| | | |<br />|____________|___________|____________|<br />. |<br />|__________i|<br />. .<br />: |<br />| _i|<br />_ |_____..i|_||<br />`'-. "``-.!<br />` '<br />P r o u d l y . P r e s e n t s . .<br />. _<br />_________________________|( \.-.___________`-.___ _ ___________<br />| |<br />| JetBrains PyCharm v1.2.1 |<br />| (c) JetBrains |<br />| date : 15 Apr, 2o11 size : 14 disks/5.00 MB |<br />| os : WinAll language : English |<br />| type : Development |<br />| protection : RSA-512 |<br />|_____________________________________________________________. |<br />______________________________________________________<br />: | .' :<br />._ | |__________________________________________________. | _.<br />|/ | | \|<br />&lt; __ [ r e l e a s e . i n f o ] __ &gt;<br />\ | | /<br />\ | JetBrains PyCharm - Python IDE with complete set of tools | /<br />\| for productive development with Python programming |/<br />` language. '<br />. In addition, the IDE provides high-class capabilities for .<br />: professional Web development with Django framework. :<br />| |<br />| Coding Assistance |<br />| |<br />| Code faster and with more pleasure in a smart and |<br />| configurable editor with code completion, snippets and |<br />| various intention actions |<br />| Code Analysis |<br />| |<br />| Take advantage of on-the-fly code syntax, error |<br />| highlighting, intelligent inspections and one-click quick- |<br />| fix suggestions to make code better |<br />| Project Code Navigation |<br />| |<br />| Instantly navigate from one file to another, from method to |<br />| its declaration or usages, and through classes hierarchy. |<br />| Learn keyboard shortcuts to be even more productive |<br />| Python Refactoring |<br />| |<br />| Make project-wide code changes painlessly with rename, |<br />| extract method, introduce field/variable/constant and pull |<br />| up/push down refactorings |<br />| Web Development with Django |<br />| |<br />| Even more rapid Web development with Django framework |<br />| backed up with excellent HTML, CSS and JavaScript editing |<br />| facilities |<br />| Google App Engine Support |<br />| |<br />| Develop applications for Google App Engine and delegate |<br />| routine deployment tasks to the IDE |<br />| |<br />| |<br />| INSTALL NOTES: |<br />| |<br />| Use the included Keymaker to register... |<br />| __|__ __<br />|_ E n j o y . . . /\ \\ `<br />|_|_____________________________________________________ __/ \____\\<br />)/\ \ / /<br />:::::::::::::::: [ g r o u p . i n f o ] ::::::::::: " \_\/____/<br />_ ____________________________________________________ _ / /\<br />|_| /____/ \<br />| It is 2010, and we are still here, almost 10 years `" \ /<br />| old. We strive to bring you quality above all else, .____\/<br />| and hope to inspire other groups to do the same. |<br />| |<br />| Let us set an example, and motivate future generations |<br />| to learn reverse engineering, and join the scene. |<br />__ __|__ |<br />' // /\ We hope that, with your help, we can continue to |<br />//____/ \__ tackle every protection. |<br />\ \ / / |<br />\____\/_/ Contact information: contact-emb@qq.com |<br />/\ \ . |<br />/ \____\ E M B R A C E .:: |<br />\ / "' established in October 2000 . .: .:::: |<br />\/____. _ _______________________ ______________________________|<br />__/ /_<br />[ g r e e |_ __/ i n g s ]<br />i.___________________________/ /_______________________________.i<br />| |<br />| |<br />| SSG TMG ECLiPSE ZWT AGAiN SHOCK LND CAFE DAMN TNO BAT |<br />: ACME ADDICTION NULL DI AiR :<br />. .<br />. ... and to all our old members: may you one day find .<br />' | your way back to us! ... | `<br />i | | i<br />__| |_ From the sky we will rise and conquer like we did so _| |___<br />/\ __ many times before, we will show the spirit of .. __ /\<br />/ \__/\ ....... /\__/ \<br />\ / \ `:::' .. / \ /<br />\/_ \ :::::: ::. ` .:: :::::: `: :: :::::: / _\/<br />/ \___ _ : ...: : `:' : : ...:. : : : _ ___/ \<br />\ / :..... : :. .: : :.....: : :....: \ /<br />\ / `:' \ /<br />\ / :. .: E M B R A C E ! \ /<br />\/__ _ `:' _ __\/<!--c2--></div>
<!--ec2--><br /><br /><!--coloro:red--><span style="color: red"><!--/coloro-->下载链接来自sharevirus,<br /></span></div>
<br />有效注册码：<br /><br />usersName: Rty<br />LicenceKey：<br />===== LICENSE BEGIN =====<br />81008-12042010<br />00001owbTYAETk4zVzRIQo10WQVS4U<br />9Kf7q6uf!4p2qkeLKQdSW"IWiz!ddS<br />JSH4KB"YmBpICAZnG25E2u5ohOPOLk<br />===== LICENSE END =====<br /><br /><div>szf</div><div><div>===== LICENSE BEGIN =====</div><div>85700-12042010</div><div>00001XPDYm7eosc1rFtt4cOOwlVKpz</div><div>1EvJKnFCPTSizjPMEH1c28MxZmIjvh</div><div>mroETWBXg6qv!o9uOY6p6vB"pNTMnO</div><div>===== LICENSE END =====<br /></div></div><br /><div>1000</div><div><div>===== LICENSE BEGIN =====</div><div>13904-12042010</div><div>00002k73nc9!bn94HR9QjG"wyY58v8</div><div>dtRMmAOKp0E4pCxRyCNWVQtBIoa594</div><div>e3dp5yHVnIhfagASpq75c5UF9TQQGy</div><div>===== LICENSE END =====<br /><div>yyyy</div></div></div><div><div>===== LICENSE BEGIN =====</div><div>94649-12042010</div><div>00001qnh1L7nX2WFWedkO3WCo520a3</div><div>dAfLTBmuqIJhW1Gza7qknW9VH!lObq</div><div>8TDmXRQEONZQzkaoSzV46meFyQRVS2</div><div>===== LICENSE END =====</div></div><img src ="http://www.cppblog.com/lauer3912/aggbug/145962.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-05-08 18:08 <a href="http://www.cppblog.com/lauer3912/archive/2011/05/08/145962.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Creating a Custom Installer for Mac (PackageMaker Package)</title><link>http://www.cppblog.com/lauer3912/archive/2011/05/07/145868.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Fri, 06 May 2011 23:35:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/05/07/145868.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/145868.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/05/07/145868.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/145868.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/145868.html</trackback:ping><description><![CDATA[Creating a Custom Installer for Mac (PackageMaker Package)<br><br>
<div style="DISPLAY: none" id=cboxOverlay jQuery1304724738590="3"></div>
<div style="PADDING-BOTTOM: 60px; PADDING-RIGHT: 0px; DISPLAY: none" id=colorbox class=cboxIE jQuery1304724738590="13">
<div id=cboxWrapper>
<div>
<div style="FLOAT: left" id=cboxTopLeft></div>
<div style="FLOAT: left" id=cboxTopCenter></div>
<div style="FLOAT: left" id=cboxTopRight></div>
</div>
<div style="CLEAR: left">
<div style="FLOAT: left" id=cboxMiddleLeft></div>
<div style="FLOAT: left" id=cboxContent>
<div style="WIDTH: 0px; HEIGHT: 0px; OVERFLOW: hidden" id=cboxLoadedContent jQuery1304724738590="5"></div>
<div id=cboxLoadingOverlay jQuery1304724738590="6"></div>
<div id=cboxLoadingGraphic jQuery1304724738590="7"></div>
<div id=cboxTitle jQuery1304724738590="8"></div>
<div id=cboxCurrent jQuery1304724738590="9"></div>
<div id=cboxNext jQuery1304724738590="10"></div>
<div id=cboxPrevious jQuery1304724738590="11"></div>
<div id=cboxSlideshow jQuery1304724738590="4"></div>
<div id=cboxClose jQuery1304724738590="12"></div>
</div>
<div style="FLOAT: left" id=cboxMiddleRight></div>
</div>
<div style="CLEAR: left">
<div style="FLOAT: left" id=cboxBottomLeft></div>
<div style="FLOAT: left" id=cboxBottomCenter></div>
<div style="FLOAT: left" id=cboxBottomRight></div>
</div>
</div>
<div style="POSITION: absolute; WIDTH: 9999px; DISPLAY: none; VISIBILITY: hidden"></div>
</div>
<ul id=banners>
    <script id=banner-item-template type=text/html data-template-name="banner-item">
    <li>
    <span class='icon'>&nbsp; &nbsp; &nbsp; </span>
    <span class='content'>{{ text }}</span>
    <span class='ignore'>(<a href='#'>ignore this</a>)</span>
    <span class='reload'>(<a href=''>reload</a>)</span>
    </li>
    </script>
</ul>
<div id=page sizset="0" sizcache="4">
<div id=top sizset="0" sizcache="4">
<div id=header sizset="0" sizcache="4">
<div id=top-right><a href="http://support.identityfinder.com/login"><u>login</u></a> | <a href="http://support.identityfinder.com/registration"><u>sign up</u></a></div>
<div id=header_container sizset="0" sizcache="4">
<table id=table_header sizset="0" sizcache="4">
    <tbody sizset="0" sizcache="4">
        <tr sizset="0" sizcache="4">
            <td sizset="0" sizcache="4"><a title="" href="http://www.identityfinder.com/" target=_blank sizset="0" sizcache="4"><u><img id=logo alt="" src="http://asset2.zendesk.com/system/logos/0003/3155/support_portal.png?1303926452"></u></a> </td>
            <td sizset="1" sizcache="4"><img id=logo-delimiter alt="" src="http://asset3.zendesk.com/images/logo-delimiter.png?1303926452"> </td>
            <td><a href="http://support.identityfinder.com/home">Identity Finder Support Portal</a></td>
        </tr>
    </tbody>
</table>
</div>
</div>
<div id=top-menu-background sizset="0" sizcache="2">
<div id=top-menu sizset="0" sizcache="2">
<ul style="WIDTH: 100%" id=green sizset="0" sizcache="2">
    <li class="main clazz tab_home first" sizset="0" sizcache="2" data-tracking-activity="Home"><a class=tab href="http://support.identityfinder.com/home" jQuery1304724738590="14"><strong>Home</strong></a> </li>
    <li class="main tab_forums" data-tracking-activity="Support Topics"><a class=tab href="http://support.identityfinder.com/forums" jQuery1304724738590="15"><strong>Support Topics</strong></a></li>
    <li class="main clazz tab_new" sizset="1" sizcache="2" data-tracking-activity="Submit a request"><a class=tab href="http://support.identityfinder.com/anonymous_requests/new" jQuery1304724738590="16"><strong>Submit a request</strong></a> </li>
    <li class="main clazz tab_requests" sizset="2" sizcache="2" data-tracking-activity="Check your existing requests"><a class=tab href="http://support.identityfinder.com/requests" jQuery1304724738590="17"><strong>Check your existing requests</strong></a> </li>
</ul>
</div>
</div>
</div>
<div id=container class="clearfix full_width" sizset="2" sizcache="4">
<div id=flash></div>
<script type=text/javascript>
//<![cdata[
zd.jsInitializers.push(["shared/_alert",["password_expiration"]]);
//]]&gt;
</script>
<div id=flash_messages></div>
<div id=contentwrapper sizset="2" sizcache="4">
<div id=contentcolumn sizset="2" sizcache="4">
<script type=text/javascript>
//<![cdata[
zd.jsInitializers.push(["entries/_forums2_show",[{"is_moderator?":false}]]);
//]]&gt;
</script>
<div class="content content_grey" sizset="2" sizcache="4">
<div class=grey_box_top>
<div class="box box_top"></div>
</div>
<div class="content-top-right top">
<p><a class=rss href="http://support.identityfinder.com/entries/180010-creating-a-custom-installer-for-mac-packagemaker-package.rss"><u>RSS</u></a> </p>
</div>
<h2 class=forums><a href="http://support.identityfinder.com/forums">Support Topics</a><span class=delim><font color=#bbbbbb>/</font></span><a href="http://support.identityfinder.com/forums/22609-knowledge-base">Knowledge Base</a></h2>
<div class=frame sizset="2" sizcache="4">
<div style="PADDING-BOTTOM: 0px" class="entry nobottom" sizset="2" sizcache="4">
<h3 style="PADDING-BOTTOM: 9px" class=entry-title>Creating a Custom Installer for Mac (PackageMaker Package)</h3>
<img class=entry_user src="http://support.identityfinder.com/system/photos/0007/5297/idf-tile_thumb.png">
<div class=entry-container>
<p class=entry_user>Support<br>posted this on May-23 2010 02:38 pm </p>
</div>
<div class="user_formatted header_section">
<h2>Overview</h2>
<p>While Identity Finder is distributed from the IdentityFinder.com website as a dmg, modification to the dmg or application bundle contained therein are not supported. Any organization using Identity Finder for Mac version 3.0 or later (which can take advantage of the management capabilities of Identity Finder Enterprise Console version 4.5 or later) must create and deploy a custom Installer Package that can include a custom plist, license file, and other supplementary files as well as configure the endpoint service application.</p>
<p>The only supported method for creating a custom Installer Package is to use the builds scripts referenced by and attached to this article. These build scripts require the PackageMaker application available with the Apple Developer Tools to be installed on the system used to create the package. Please refer to the <a href="http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/PackageMakerUserGuide/PackageMaker_UserGuide.pdf">Apple User Guide</a> (external PDF link) for complete documentation.</p>
<p><strong><font color=#444444>Note</font></strong>: Configuring HTTPS/SSL is outside the scope of this article. If SSL is to be utilized, it is necessary to ensure that the required files and settings are available prior to building the package. For additional information, please refer to the article:</p>
<ul>
    <li><a href="http://support.identityfinder.com/entries/75901">Enabling SSL communication between Mac clients and the Enterprise Console</a>. </li>
</ul>
<p><strong><font color=#444444>Note</font></strong>: This information only applies to Identity Finder for Mac v3.7 and later. For reference or configuring/troubleshooting an earlier installation package, refer to this KB:</p>
<ul>
    <li><a href="http://support.identityfinder.com/entries/353445">Creating a Custom Installer for Mac (PackageMaker Package) - v3.0-3.6</a>. </li>
</ul>
<p>This article contains the following sections:</p>
<ul>
    <li><a href="http://support.identityfinder.com/entries/180010#files">Obtaining the Installation Files</a> (required)
    <li><a href="http://support.identityfinder.com/entries/180010#prep">Preparing the Installation Files</a> (required)
    <li><a href="http://support.identityfinder.com/entries/180010#build">Building the Installer Package</a> (required)
    <li><a href="http://support.identityfinder.com/entries/180010#test">Testing the Package</a> (required)
    <li><a href="http://support.identityfinder.com/entries/180010#upgrade">Removing files on upgrade</a> (optional)
    <li><a href="http://support.identityfinder.com/entries/180010#downloads">Attachments</a> </li>
</ul>
<p>&#160;</p>
<h2><a name=files><font color=#1a6690>Obtaining the Installation Files</font></a></h2>
<p>To begin the process, download the build script, Identity Finder application, and client/console communication configuration file.</p>
<ol>
    <li>Download the file <a href="http://support.identityfinder.com/entries/180010#downloads">IdentityFinderPackageBuilder.zip</a> containing the build scripts.
    <li>Download the most recent version of <a href="http://www.identityfinder.com/us/Business/Downloads/Mac">IdentityFinderMacSetup.dmg</a>.
    <li>Download the <a href="http://support.identityfinder.com/entries/180063#communication">plist with the client/console communication settings</a> from the enterprise console. </li>
</ol>
<p>&#160;</p>
<h2><a name=prep><font color=#1a6690>Preparing the Installation Files</font></a></h2>
<p>Before executing the script to build the package, it is necessary to organize the files that will be included in the package.</p>
<ol>
    <li>Extract IdentityFinderPackageBuilder.zip to the system that will be used to build the package. That system must have Apple Package Maker installed.
    <li>Place the application dmg, IdentityFinderMacSetup.dmg, in the IdentityFinderPackageBuilder folder. The necessary files will be automatically extracted by the script. By default, the application will be installed to:
    <pre>/Applications/Identity Finder.app</pre>
    <li>If using a license file, place the license file - identityfinder.lic - in the IdentityFinderPackageBuilder/Resources folder. By default, this file will be installed to:
    <pre>/Library/Application Support/Identity Finder/identityfinder.lic</pre>
    <li>If using an enterprise console, place the system plist obtained from the Console - com.identityfinder.macedition.plist - in the IdentityFinderPackageBuilder/Resources folder. By default, this file will be installed to:
    <pre>/Library/Preferences/com.identityfinder.macedition.plist</pre>
    <li>Optionally edit the system plist to add in other settings (not recommended)
    <li>If using HTTPS/SSL:
    <ol>
        <li>Edit the system plist to add the SSL settings. More information on SSL and the necessary settings, is available in the KB article <a href="http://support.identityfinder.com/entries/75901">Enabling SSL communication between Mac clients and the Enterprise Console</a>.
        <li>Place the certificate file - ca.Pem - in the IdentityFinderPackageBuilder/Resources folder. By default, this file will be installed to:
        <pre>/Library/Application Support/Identity Finder/ca.pem</pre>
        </li>
    </ol>
    </li>
</ol>
<p>&#160;</p>
<h2><a name=build><font color=#1a6690>Building the Installer Package</font></a></h2>
<p>The process of building the pkg installer package is performed by executing the script IdentityFinderPackageBuilder.sh at a command prompt, as follows:</p>
<ol>
    <li>Open a Terminal window
    <li>Change directory (cd) to the IdentityFinderPackageBuilder/Resources directory
    <pre>cd IdentityFinderPackageBuilder/Resources</pre>
    <li>Verify that all the scripts are executable. If necessary, change the permissions for each script by executing chmod ugo+x. For example:
    <pre>chmod ugo+x preflight<br>chmod ugo+x preinstall</pre>
    <li>Change directory to the IdentityFinderPackageBuilder directory
    <pre>cd ..</pre>
    <li>Verify that the IdentityFinderPackageBuilder.sh script file is executable. If ncessary, change the permissions by executing chmod ugo+x. For example:
    <pre>chmod ugo+x IdentityFinderPackageBuilder.sh</pre>
    <li>Execute the IdentityFinderPackageBuilder.sh script. The script requires one of the following two parameters:
    <ul>
        <li>-RootAuth: Root authorization will be required when the installer runs. This parameter should be used for the initial user-initiated install as root authorization must be obtained to allow the installation of the system resources.
        <li>-NoRootAuth: Root authorization will not be required when the installer runs. This parameter is used during subsequent automatic and silent upgrades where the installer will run with root permissions. </li>
    </ul>
    To require root authorization, use the -RootAuth parameter:
    <pre>./IdentityFinderPackageBuilder.sh -RootAuth</pre>
    <li>Press the spacebar to scroll through the license agreement until the &#8220;Agree Y/N?&#8221; prompt is displayed
    <li>Type 'y' at the prompt </li>
</ol>
<p>The script will then run to completion and create IdentityFinder.pkg in the folder IdentityFinderPackageBuilder/Output. Once completed, test the package.</p>
<p>&#160;</p>
<h2><a name=test><font color=#1a6690>Testing the Package</font></a></h2>
<p>After building the package, it is necessary to execute the package to verify that all of the components are properly installed and that the endpointservice is started.</p>
<ol>
    <li>Open a Finder window to the location containing the newly created IdentityFinder.pkg file
    <li>Run the installer. The install may be monitored for status by performing the following steps:
    <ul>
        <li>At the Welcome screen, select the Window menu and then select, &#8220;Installer Log&#8221;
        <li>In the Detail Level popup, select, "Show All Logs"
        <li>Example of a successful console log:<br>
        <pre>Dec  8 11:52:40 Installer[51892]: @(#)PROGRAM:Install  PROJECT:Install-388<br>Dec  8 11:52:40 Installer[51892]: @(#)PROGRAM:Installer  PROJECT:Installer-281<br>Dec  8 11:52:40 Installer[51892]: Hardware: MacBookPro5,2 @ 2.93 GHz (x 2), 8192 MB RAM<br>Dec  8 11:52:40 Installer[51892]: Running OS Build: Mac OS X 10.5.8 (9L31a)<br>Dec  8 11:52:40 Installer[51892]: Env: PATH=/usr/bin:/bin:/usr/sbin:/sbin<br>Dec  8 11:52:40 Installer[51892]: Env: TMPDIR=/var/folders/ka/kaBzHl2IG6yXTTiPRDoALU+++TI/-Tmp-/<br>Dec  8 11:52:40 Installer[51892]: Env: SHELL=/bin/bash<br>Dec  8 11:52:40 Installer[51892]: Env: HOME=/Users/devuser<br>Dec  8 11:52:40 Installer[51892]: Env: USER=devuser<br>Dec  8 11:52:40 Installer[51892]: Env: LOGNAME=devuser<br>Dec  8 11:52:40 Installer[51892]: Env: DISPLAY=/tmp/launch-3zJTAy/:0<br>Dec  8 11:52:40 Installer[51892]: Env: SSH_AUTH_SOCK=/tmp/launch-aGzIG1/Listeners<br>Dec  8 11:52:40 Installer[51892]: Env: Apple_PubSub_Socket_Render=/tmp/launch-yUzIST/Render<br>Dec  8 11:52:40 Installer[51892]: Env: __CF_USER_TEXT_ENCODING=0x1F5:0:0<br>Dec  8 11:52:40 Installer[51892]: Env: SECURITYSESSIONID=965b9be0<br>Dec  8 11:52:40 Installer[51892]: Env: COMMAND_MODE=unix2003<br>Dec  8 11:52:40 Installer[51892]: Env: CVS_RSH=ssh<br>Dec  8 11:52:40 Installer[51892]: Identity Finder Installation Log<br>Dec  8 11:52:40 Installer[51892]: Opened from: /Users/devuser/Documents/workspace/IdfMacPublic/Installer/IdentityFinderPackageBuilder/IdentityFinder.pkg<br>Dec  8 11:52:41 installdb[51894]: started (uid 96)<br>Dec  8 11:52:41 installdb[51894]: Opened receipt database on '/' with schema 17.<br>Dec  8 11:52:41 Installer[51892]: Found receipt (full match) for (identityfinder / com.identityfinder.pkg): (identityfinder / com.identityfinder.pkg)<br>Dec  8 11:52:47 installdb[51894]: done. (0.004u + 0.003s)<br>Dec  8 11:52:55 runner[51895]: Administrator authorization granted.<br>Dec  8 11:52:55 Installer[51892]: ================================================================================<br>Dec  8 11:52:55 Installer[51892]: User picked Standard Install<br>Dec  8 11:52:55 Installer[51892]: Choices selected for installation:<br>Dec  8 11:52:55 Installer[51892]: 	Upgrade: "Identity Finder"<br>Dec  8 11:52:55 Installer[51892]: 		IdentityFinder.pkg : com.identityfinder.pkg : 3.7.0.3.7<br>Dec  8 11:52:55 Installer[51892]: ================================================================================<br>Dec  8 11:52:55 Installer[51892]: It took 0.00 seconds to summarize the package selections.<br>Dec  8 11:52:55 Installer[51892]: -[IFPKGDerivedDocument sortedPackageLocations]: result = (\n    file://localhost\n)<br>Dec  8 11:52:55 Installer[51892]: -[IFDInstallController(Private) _buildInstallPlan]: location = file://localhost<br>Dec  8 11:52:55 Installer[51892]: -[IFDInstallController(Private) _buildInstallPlan]: file://localhost/Users/devuser/Documents/workspace/IdfMacPublic/Installer/IdentityFinderPackageBuilder/IdentityFinder.pkg<br>Dec  8 11:52:55 Installer[51892]: _installNextPackage of 1<br>Dec  8 11:52:55 installdb[51896]: started (uid 96)<br>Dec  8 11:52:55 installdb[51896]: Opened receipt database on '/' with schema 17.<br>Dec  8 11:52:55 Installer[51892]: Found receipt (full match) for (identityfinder / com.identityfinder.pkg): (identityfinder / com.identityfinder.pkg)<br>Dec  8 11:52:55 Installer[51892]: Starting installation:<br>Dec  8 11:52:55 Installer[51892]: Preparing volume "Macintosh HD" for installation<br>Dec  8 11:52:55 Installer[51892]: Configuring volume "Macintosh HD"<br>Dec  8 11:52:56 Installer[51892]: Preparing disk for local booted install.<br>Dec  8 11:52:56 Installer[51892]: Free space on "Macintosh HD": 49.3 GB (52892991488 bytes).<br>Dec  8 11:52:56 Installer[51892]: Create temporary directory "/private/tmp/IdentityFinder.pkg.51892EztnrK"<br>Dec  8 11:52:56 Installer[51892]: run preflight script for Identity Finder<br>Dec  8 11:52:56 runner[51895]: preflight[51897]: Starting Identity Finder installer preflight script<br>Dec  8 11:52:56 runner[51895]: preflight[51897]: Ending Identity Finder installer preflight script<br>Dec  8 11:52:56 runner[51895]: preflight[51897]: <br>Dec  8 11:52:56 Installer[51892]: Processing Identity Finder:<br>Dec  8 11:52:56 Installer[51892]: 	Determining files to install<br>Dec  8 11:52:56 Installer[51892]: 	It took 0.01 seconds to create the install plan for identityfinder.<br>Dec  8 11:52:56 Installer[51892]: 	Removing previously installed languages<br>Dec  8 11:52:56 Installer[51892]: 	Configuring deferred files<br>Dec  8 11:52:56 Installer[51892]: 	Determining obsolete files<br>Dec  8 11:52:56 Installer[51892]: 	Assembling temporary receipt<br>Dec  8 11:52:57 Installer[51892]: 	Performing pre-extraction actions<br>Dec  8 11:52:57 Installer[51892]: 	run preupgrade script for Identity Finder<br>Dec  8 11:52:57 runner[51895]: preupgrade[51899]: Starting pre_upgrade script<br>Dec  8 11:52:57 runner[51895]: preupgrade[51899]: End pre_upgrade script<br>Dec  8 11:52:57 runner[51895]: preupgrade[51899]: <br>Dec  8 11:52:57 Installer[51892]: 	Removing obsoleted files<br>Dec  8 11:52:57 Installer[51892]: 	Creating destination path<br>Dec  8 11:52:57 Installer[51892]: 	Validating package payload<br>Dec  8 11:52:57 Installer[51892]: 	Starting file extraction<br>Dec  8 11:52:57 pkgExtractor[51900]: 	Extracting...<br>Dec  8 11:52:58 pkgExtractor[51900]: 	265 of 265 files written in 1.41 seconds.<br>Dec  8 11:52:58 pkgExtractor[51900]: 	44500 kilobytes installed at 30.9 MB/s.<br>Dec  8 11:52:58 Installer[51892]: 	run postupgrade script for Identity Finder<br>Dec  8 11:52:58 runner[51895]: postupgrade[51903]: Starting Identity Finder installer /Users/devuser/Documents/workspace/IdfMacPublic/Installer/IdentityFinderPackageBuilder/IdentityFinder.pkg/Contents/Resources/postupgrade script<br>Dec  8 11:52:58 runner[51895]: postupgrade[51903]: Copying EndpointService to /Library/Application Support/Identity Finder...<br>Dec  8 11:52:59 runner[51895]: postupgrade[51903]: EndpointService successfully copied to /Library/Application Support/Identity Finder<br>Dec  8 11:52:59 runner[51895]: postupgrade[51903]: Copying com.identityfinder.launchdaemon.plist to /Library/LaunchDaemons...<br>Dec  8 11:52:59 runner[51895]: postupgrade[51903]: com.identityfinder.launchdaemon.plist cp result = 0<br>Dec  8 11:52:59 runner[51895]: postupgrade[51903]: Loading com.identityfinder.launchdaemon.plist...<br>Dec  8 11:52:59 runner[51895]: postupgrade[51903]: launchctl load /Library/LaunchDaemons/com.identityfinder.launchdaemon.plist result = 0<br>Dec  8 11:52:59 runner[51895]: postupgrade[51903]: Setting owner root:admin for /Applications/Identity Finder.app.<br>Dec  8 11:52:59 runner[51895]: postupgrade[51903]: Setting file mode to 775 for /Applications/Identity Finder.app.<br>Dec  8 11:52:59 runner[51895]: postupgrade[51903]: Ending Identity Finder installer /Users/devuser/Documents/workspace/IdfMacPublic/Installer/IdentityFinderPackageBuilder/IdentityFinder.pkg/Contents/Resources/postupgrade script<br>Dec  8 11:52:59 Installer[51892]: 	Performing post-extraction actions<br>Dec  8 11:52:59 Installer[51892]: 	Finishing receipt<br>Dec  8 11:52:59 Installer[51892]: run postflight script for Identity Finder<br>Dec  8 11:52:59 runner[51895]: postflight[51916]: Starting post_flight script<br>Dec  8 11:52:59 runner[51895]: postflight[51916]: End post_flight script<br>Dec  8 11:52:59 Installer[51892]: Removing temporary directory "/private/tmp/IdentityFinder.pkg.51892EztnrK"<br>Dec  8 11:52:59 Installer[51892]: Finalize disk "Macintosh HD"<br>Dec  8 11:52:59 Installer[51892]: Notifying system of updated components<br>Dec  8 11:52:59 Installer[51892]: _installNextPackage of 0<br>Dec  8 11:52:59 Installer[51892]: <br>Dec  8 11:52:59 Installer[51892]: **** Summary Information ****<br>Dec  8 11:52:59 Installer[51892]:   Operation      Elapsed time<br>Dec  8 11:52:59 Installer[51892]: -----------------------------<br>Dec  8 11:52:59 Installer[51892]:      script      0.91 seconds<br>Dec  8 11:52:59 Installer[51892]:        zero      0.01 seconds<br>Dec  8 11:52:59 Installer[51892]:     install      2.79 seconds<br>Dec  8 11:52:59 Installer[51892]:    validate      0.00 seconds<br>Dec  8 11:52:59 Installer[51892]:          os      0.00 seconds<br>Dec  8 11:52:59 Installer[51892]:     extract      1.50 seconds<br>Dec  8 11:52:59 Installer[51892]:     receipt      0.41 seconds<br>Dec  8 11:52:59 Installer[51892]:        disk      1.01 seconds<br>Dec  8 11:52:59 Installer[51892]:      config      0.02 seconds<br>Dec  8 11:52:59 Installer[51892]: <br>Dec  8 11:53:00 Installer[51892]: Starting installation:<br>Dec  8 11:53:00 Installer[51892]: Finalizing installation.<br>Dec  8 11:53:00 Installer[51892]: Registering applications<br>Dec  8 11:53:00 runner[51895]: Touched '/Applications/Identity Finder.app'<br>Dec  8 11:53:00 Installer[51892]: Registered /Applications/Identity Finder.app.<br>Dec  8 11:53:00 runner[51895]: Touched '/Applications/./Identity Finder.app'<br>Dec  8 11:53:00 runner[51895]: Touched '/Applications/.'<br>Dec  8 11:53:00 Installer[51892]: IFDInstallController 85DB40 state = 5<br>Dec  8 11:53:00 Installer[51892]: Displaying 'Install Succeeded' UI.<br>Dec  8 11:53:01 installdb[51896]: done. (0.004u + 0.003s)<br></pre>
        </li>
    </ul>
    <li>Verify that the application has been installed to /Applications (or the appropriate location if the script was modified).
    <pre>/Applications/Identity Finder.app</pre>
    <li>Verify that the license file, certificate file, and system plist were all installed to the specified locations. For example:
    <pre>/Library/Application Support/Identity Finder/identityfinder.lic<br>/Library/Application Support/Identity Finder/ca.pem<br>/Library/Preferences/com.identityfinder.macedition.plist<br></pre>
    <li>Verify that the launchdaemon, which automatically starts the endpoint service at system start-up, was installed to:
    <pre>/Library/LaunchDaemons/com.identityfinder.launchdaemon.plist</pre>
    <li>Verify that the endpoint service binary was installed to:
    <pre>/Library/Application Support/Identity Finder/EndpointService</pre>
    <li>Test the installed application to ensure that a search runs to completion and that the results appear in the console. </li>
</ol>
<p>&#160;</p>
<h2><a name=upgrade><font color=#1a6690>Removing files on upgrade</font></a></h2>
<p>When executing an upgrade with a PackageMaker package, no files will be removed even if these files are not present in the new package. If it is necessary to remove files on upgrade, a Preflight script must be created and included in the new package by specifying its location on the Scripts tab within PackageMaker. For example, this script will delete a preexisting Identity Finder.app. Note: Be extremely careful when using this script as an error in any path may result in the deletion of all applications on the system. It is likely more desirable to move the old files to $HOME/.Trash and/or rename them.</p>
<p>A sample Uninstall script is attached to this article as UninstallIDF.sh.</p>
<p>&#160;</p>
<h2><a name=downloads><font color=#1a6690>Attachments</font></a></h2>
<ul>
    <li><a href="http://www.identityfinder.com/software/MacInstaller/IdentityFinderPackageBuilder.zip">IdentityFinderPackageBuilder.zip</a> (updated 3/14/2011)
    <li><a href="http://www.identityfinder.com/software/MacInstaller/UninstallIDF.sh">UninstallIDF.sh</a> </li>
</ul>
</div>
<div id=voting_control class="header_section for_vote"><strong>1 Person</strong> found this helpful <a href="http://support.identityfinder.com/login?return_to=http%3A%2F%2Fsupport.identityfinder.com%2Fentries%2F180010-creating-a-custom-installer-for-mac-packagemaker-package">- <strong>Me too!</strong></a> </div>
<script type=text/javascript charset=utf-8>
new Ajax.Updater('voting_control', '/entries/180010-creating-a-custom-installer-for-mac-packagemaker-package/voting_control', {asynchronous:true, evalScripts:true, method:'get', parameters:'authenticity_token=' + encodeURIComponent('xd8AzJ8bghDEJ7wYH4ugwCO+gOZ2Dy441FHN9K7ihAs=')})
</script>
</div>
</div>
<div class=grey_box_bottom>
<div class="box box_bottom"></div>
</div>
</div>
<div class=box_bottom_clear></div>
<div class="content content_green">
<div class=green_box_top>
<div class="box box_top"></div>
</div>
<div class=action><strong>Topic is closed for comments</strong></div>
<div class=green_box_bottom>
<div class="box box_bottom"></div>
</div>
</div>
<div class=box_bottom_clear></div>
<div id=edit></div>
<script type=text/javascript>
//<![cdata[
zd.jsInitializers.push(["entries/show",[]]);
//]]&gt;
</script>
</div>
</div>
<div id=sidebar></div>
</div>
</div>
<div id=footer>
<p><a href="http://www.zendesk.com/"><u>Help Desk Software</u></a> by Zendesk</p>
</div>
<!-- Render any mouseover tips on the page -->
<script type=text/javascript>
//<![cdata[
if(!Zendesk) var Zendesk = {};
Zendesk.tab = "";
//]]&gt;
</script>
<script type=text/javascript src="http://asset0.zendesk.com/assets/auto_included.js?1303926452"></script>
<script type=text/javascript>
//<![cdata[
$z.initializeModules(zd.jsInitializers);
//]]&gt;
</script>
<script type=text/javascript charset=utf-8>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
Widget.require(gaJsHost + "google-analytics.com/ga.js");
document.observe('widgets:load', function() {
try {
var pageTracker = _gat._getTracker("UA-3386435-1");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
} catch(err) {}
});
</script>
<script type=text/javascript charset=utf-8>
if(window.location.href.match(/\.com\/home$/)) {
var homediv = $('contentcolumn').select('div.content')[1];
homediv.select('h2')[0].hide();
homediv.select('div.content-top-right').invoke('hide');
$('pinned-entry-207457').select('div.fade_truncation_outer')[0].hide();
$('pinned-entry-207457').select('p.sub')[0].hide();
}
Widget.require("http://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22search%22%2C%22version%22%3A%221%22%2C%22callback%22%3A%22OnGoogleLoaded%22%2C%22language%22%3A%22en%22%7D%5D%7D");
var hse = null;
var GoogleSearchComplete2 = function() {
var maindiv = $('contentcolumn').select('div.content')[1];
var h2 = maindiv.select('h2')[0];
if($('search-result') == undefined) {
h2.update(hse.results.size() + ' results found');
h2.insert({after: '
<div id="search-result" class="frame"></div>
' });
}
else {
$('search-result').select('h3.empty_result_set').invoke('hide');
if(h2 == undefined) {
$('search-result').insert('
<h3>'+hse.results.size()+' results found</h3>
');
}
else {
var count = h2.innerHTML.match(/^\d+/);
if(count)
{
var newcount = parseInt(count[0])+hse.results.size();
h2.update(newcount + ' results found');
}
}
}
hse.results.each(function(result)
{
$('search-result').insert(searchHelpItemTemplate.evaluate(result));
});
}
var GoogleSearchComplete = function() {
hse.results.each(function(result) {
$('topic_search_result').insert(helpItemTemplate.evaluate(result));
});
if ($('topic_search_result').empty()) {
$('topic_search_result').update('
<h2 class="empty_suggestion_set">No topics found</h2>
');
}
}
var OnGoogleLoaded = function() {
hse = new google.search.WebSearch();
hse.setSiteRestriction("016097406573449901406:wzhs4axksii");
hse.setResultSetSize(google.search.Search.SMALL_RESULTSET);
hse.setRestriction(google.search.Search.RESTRICT_SAFESEARCH,google.search.Search.SAFESEARCH_OFF);
if(window.location.href.match(/\/search\?query\=/)) {
hse.setSearchCompleteCallback(window, this.GoogleSearchComplete2 , null);
var q = $('searchform').serialize(true).query;
hse.execute(q);
} else {
hse.setSearchCompleteCallback(window, this.GoogleSearchComplete , null);
}
}
//turn off any event handlers that zendesk uses and create our own
$(document).stopObserving('entries:retrieved_for_home_page_search_box');
if ($('suggest_form') != undefined) {
$('suggest_form').stopObserving('submit');
$('suggest_form').observe('submit', function(event) {
$('page').value = 1;
$('topic_search_loading').addClassName('loading');
$('topic_search').hide();
$('topic_search_result').update();
custom_update_topic_search_results(event);
});
}
function custom_update_topic_search_results(event) {
var q = $('suggest_form').serialize(true).suggestions_query;
hse.execute(q);
//event.stop();
new Ajax.Updater('topic_search_result', ('/categories/search_for_home_page_box?' + $('suggest_form').serialize()), {
method: 'get',
evalScripts: true,
parameters: { format: 'html', for_search: 1, page: $('page').value },
insertion: 'top'
});
event.stop();
}
$(document).observe('entries:retrieved_for_home_page_search_box', function(event) {
$('topic_search_loading').removeClassName('loading');
$('topic_search').show();
if (event.memo.next_page === null)
{
$('show_more_results').hide();
}
else
{
$('show_more_results').show();
$$('#show_more_results a').first().show();
$$('#show_more_results .progress').first().hide();
$('page').value = event.memo.next_page;
//$$('#topic_search_result .nobottom').first().removeClassName('nobottom');
}
});
var embeddedImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAIAAAC1JZyVAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABShJREFUeNq8V99vG0UQvjvb8Y+zzxfbsZPUSZuGoqK2LwWEhMgDgoe+If5WxAOgipfyUAkFJJKASMA4cZzYPtvny/lH47tbvt2xN87ZoQlITK3L3u3sfDsz38xuVcaYchcZj8d4xmKxO63SbqnnOA4NLoWEPv5XGBjyfZ+23+/3Z6fwSj5B4a14i2GGwyENdF23bRuDZDLZd91rMK6LjxhAAWqhhbeCWVpaajYaGEQiEYSIHFoomIIC1DDGEiy8FQxZxDI9nba7XYwLhULbsnhWRPKl0CumoMB96naxhPDmtxWGQcTJeiKReGtiPc8DGDKEWMEnCh2Wh7IIUecJDT0/CPL5vOMOPI/vS1UnU1NdvogPGU9MOpNpNZv5wkohZ1w4vYimmcvLN8JgC/CAvAbS79Vm0+qqGv4BRpXmAwAEzMcAT5/5V89Ai0Q+/+jd9fUSxW00GklqRCUgPrXbbd/ziqUStlN7/asGDKYEgFHYxvrK1saakUndFMCzlv3Vy10lGicuRKJRxEPORmdVMYEir9VqaV3HHhnHYCoXpVJr4ocvQEom4tmMvpIz9FRCT8anAVWCQHEvLmqXbqlUCrWJqMwHeBITUi6XRXoQG6ZxDKZMcwNbna4bsItjZvGgBTx05bX8zoePEXroQ8rlDdmWUFuUpwkMXlDJ3U4HyTcMA68eYq2q5A2xgJIoTHGL/BfAA1Y5aZmGvrZiYpxMpZBjmAIREsmk5MJV0AwhSN2F4xxbFoI2jRg3H1+Kvv9sO51MnFv2wWFtfOlNYAQXiHhwTtMi48vLYrFIVLoWNLA+CAIUMCKGaWyBe/O6onKOCSRFef5k++EGp1CxkC3ms19//zOFKAgmYEDi6VSYuZyTQUMxaZqGnhSlfkX1xRul5/UHAzCbgsYRgAQepuJya6srpmmkWh2XXCEMhNPnZFcqlYqeSoFpMEIYV0GjF0lzTvzgIBAAlJs/T1qwLmfNbPrccmTQKG7IK+C2trbm6R6VnRVxQ0HNekN1Sbn56aCay6Yfb6+JI8c7qjY8f2Kd6MBzI2rgRm9kbq554/9CALIFfPNqb3e/em91ef/o9M0bj2IVUIqYIrzhf6Q3lBsYv8rNbIcG0yDSG+SmmMt8/Pyd+FLs5KzTc4fYNWbJD0IKBICgAC/BjGGASlSFYULD9Gg4pLrZvH/f8w84zRT+7+FmcXuzCJ3yKq+DFztPf9z769tXB1dIFDTxJ4azqtmkuoGpBV1AfsUr94Y7w+MmUntNPnj6YHf/5KzlMDZhmiA0H+pCKGiwQxWqyS5ADlJPE9FjnhcgzxicNZ2GFT7tUWPYCilQhni6FAXL5e1nQRfgR6Ho0Ohp/MjymWgy/Ll3WN87qsOxB+W8mUmhaLbK+XZ3IKjFjwbJNOiUN8r/1KHRi0zTlOdNRk/YzkDSjHdPphxVrUlbE0fclGO8EeSM1BefPctn+HIcJaASDErq3nh69gbsux9+++PEmmBMOzQ9ZjHwfLHzHn5y+fzpGV147ctzUb789FGx9EnXGdQbvdNm77Rhd3qD00Zv0lvYrFthI5JNi2HgZqi5jvq9J4/W8EPEEQ18OTq2Ona/bQ8Oq61awx6OxvdWs3IWriy4cLFFgitL4/ycxvV6Ha8Y0BdXiHzFFBRIE19Ic14WXwfRJGhr2BeaUMi/WcEUFGj7WCKv17e6dcr2Q/Sjvof6vRbedJquslCQF7PZvnWHq7ohuhOV7WxjpSxSGUIhlPB5Uf+f/9/cGebfyd8CDAA87Dx7e01CMAAAAABJRU5ErkJggg==';
var helpItemTemplate = new Template("
<div class=\"item\">
<div class=\"icon\"><img src=\""+embeddedImage+"\" title=\"User Guide\" alt=\"User Guide\" /></div>
<div class=\"item-info\">
<h1 class=\"fade_truncation_outer\"><a href=\"#{unescapedUrl}\" target=\"helpDocumentation\">#{titleNoFormatting}</a></h1>
<p class=\"info data\">#{content}</p>
<p class=\"info path\"><span class=\"forum_path\"><a href=\"http://www.identityfinder.com/help\" target=\"_blank\">User Guide &#187;</a></span></p>
</div>
</div>
");
var searchHelpItemTemplate = new Template("
<div class=\"item\">
<div class=\"icon\"><img src=\""+embeddedImage+"\" title=\"User Guide\" alt=\"User Guide\" /></div>
<div class=\"item-info\">
<h1 class=\"fade_truncation_outer\"><a href=\"#{unescapedUrl}\" target=\"helpDocumentation\">#{titleNoFormatting}</a></h1>
<p class=\"info path\"><span class=\"forum_path\"><a href=\"http://www.identityfinder.com/help\" target=\"_blank\">User Guide &#187;</a></span></p>
</div>
</div>
");
</script>
<script type=text/javascript charset=utf-8>
$j(document).ready(function () {
$j.ajax({
url: '/widgets/async.json?user_id=' + currentUser.id,
data: {"entry_id":180010,"action_method":"get","action_name":"show","controller_name":"entries"},
success: Widget.asyncInsertion
});
});
</script>
<script type=text/javascript>
//<![cdata[
jQuery(document).ready(function () {
});
//]]&gt;
</script>
<img src ="http://www.cppblog.com/lauer3912/aggbug/145868.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-05-07 07:35 <a href="http://www.cppblog.com/lauer3912/archive/2011/05/07/145868.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>buildpkg.py  的使用说明</title><link>http://www.cppblog.com/lauer3912/archive/2011/05/07/145867.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Fri, 06 May 2011 23:11:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/05/07/145867.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/145867.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/05/07/145867.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/145867.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/145867.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 源文件下载地址：http://python.net/~gherman/projects/buildpkg/当前记录版本号为: 0.3Readme############################################################################################################Readmebuildpkg...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2011/05/07/145867.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/145867.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-05-07 07:11 <a href="http://www.cppblog.com/lauer3912/archive/2011/05/07/145867.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PyQt 延迟触发槽函数 使用QTimer</title><link>http://www.cppblog.com/lauer3912/archive/2011/05/01/145450.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sun, 01 May 2011 05:21:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/05/01/145450.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/145450.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/05/01/145450.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/145450.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/145450.html</trackback:ping><description><![CDATA[<p>1、示例代码</p>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008080">1</span><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QtCore.QTimer.singleShot(self.delaySpinBox.value()&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1000</span><span style="COLOR: #000000">,<br></span><span style="COLOR: #008080">2</span><span style="COLOR: #000000"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.shootScreen)</span></div>
<br>2、关于QTimer.singleShot 的用法<br><br><span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; FONT: medium Arial; WHITE-SPACE: normal; ORPHANS: 2; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=Apple-style-span><span style="LINE-HEIGHT: 15px; FONT-FAMILY: Verdana; COLOR: rgb(54,53,52); FONT-SIZE: 13px" class=Apple-style-span>
<h3 style="BORDER-BOTTOM: rgb(230,230,230) 1px solid; BORDER-LEFT: rgb(230,230,230) 1px solid; PADDING-BOTTOM: 3px; BACKGROUND-COLOR: rgb(246,246,246); MARGIN: 15px 0px 0px; PADDING-LEFT: 5px; WIDTH: 1172px; PADDING-RIGHT: 5px; FONT: 600 16px/1.2 Arial; BORDER-TOP: rgb(230,230,230) 1px solid; BORDER-RIGHT: rgb(230,230,230) 1px solid; WORD-SPACING: 3px; PADDING-TOP: 3px; border-top-left-radius: 7px 7px; border-top-right-radius: 7px 7px; border-bottom-right-radius: 7px 7px; border-bottom-left-radius: 7px 7px" class=fn>void QTimer::singleShot ( int<span class=Apple-converted-space>&nbsp;</span><em>msec</em>,<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qobject.html">QObject</a><span class=Apple-converted-space>&nbsp;</span>*<span class=Apple-converted-space>&nbsp;</span><em>receiver</em>, const char *<span class=Apple-converted-space>&nbsp;</span><em>member</em><span class=Apple-converted-space>&nbsp;</span>)<tt style="WORD-SPACING: 5px"><span class=Apple-converted-space>&nbsp;</span>[static]</tt></h3>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">This static function calls a slot after a given time interval.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">It is very convenient to use this function because you do not need to bother with a<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qobject.html#timerEvent">timerEvent</a><span class=Apple-converted-space>&nbsp;</span>or create a local<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(76,0,51); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qtimer.html">QTimer</a><span class=Apple-converted-space>&nbsp;</span>object.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">Example:</p>
<pre style="BORDER-BOTTOM: rgb(230,230,230) 1px solid; BORDER-LEFT: rgb(230,230,230) 1px solid; PADDING-BOTTOM: 20px; OVERFLOW-X: hidden; OVERFLOW-Y: hidden; BACKGROUND-COLOR: rgb(246,246,246); MARGIN: 10px; PADDING-LEFT: 20px; PADDING-RIGHT: 15px; DISPLAY: block; BORDER-COLLAPSE: separate; FONT-SIZE: 11px; BORDER-TOP: rgb(230,230,230) 1px solid; BORDER-RIGHT: rgb(230,230,230) 1px solid; PADDING-TOP: 20px; border-top-left-radius: 7px 7px; border-top-right-radius: 7px 7px; border-bottom-right-radius: 7px 7px; border-bottom-left-radius: 7px 7px" class="highlightedCode brush: cpp"> #include &lt;QApplication&gt;
#include &lt;QTimer&gt;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTimer::singleShot(600000, &amp;app, SLOT(quit()));
...
return app.exec();
}</pre>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">This sample program automatically terminates after 10 minutes (600,000 milliseconds).</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">The<span class=Apple-converted-space>&nbsp;</span><em>receiver</em><span class=Apple-converted-space>&nbsp;</span>is the receiving object and the<span class=Apple-converted-space>&nbsp;</span><em>member</em><span class=Apple-converted-space>&nbsp;</span>is the slot. The time interval is<span class=Apple-converted-space>&nbsp;</span><em>msec</em><span class=Apple-converted-space>&nbsp;</span>milliseconds.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px"><strong>Note:</strong><span class=Apple-converted-space>&nbsp;</span>This function is<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/threads-reentrancy.html#reentrant">reentrant</a>.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">See also<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(76,0,51); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qtimer.html#singleShot-prop">setSingleShot</a>() and<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qtimer.html#start">start</a>().</p>
</span></span>
<img src ="http://www.cppblog.com/lauer3912/aggbug/145450.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-05-01 13:21 <a href="http://www.cppblog.com/lauer3912/archive/2011/05/01/145450.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PyQt 标签设置图片</title><link>http://www.cppblog.com/lauer3912/archive/2011/04/29/145370.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Fri, 29 Apr 2011 15:02:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/04/29/145370.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/145370.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/04/29/145370.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/145370.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/145370.html</trackback:ping><description><![CDATA[1. 示例代码<br><br>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008080">1</span><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.screenshotLabel.setPixmap(self.originalPixmap.scaled(<br></span><span style="COLOR: #008080">2</span><span style="COLOR: #000000"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.screenshotLabel.size(),&nbsp;QtCore.Qt.KeepAspectRatio,<br></span><span style="COLOR: #008080">3</span><span style="COLOR: #000000"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QtCore.Qt.SmoothTransformation))</span></div>
<br>2. Label 的 setPixmap函数说明<br><br><span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; FONT: medium Arial; WHITE-SPACE: normal; ORPHANS: 2; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=Apple-style-span><span style="LINE-HEIGHT: 15px; FONT-FAMILY: Verdana; COLOR: rgb(54,53,52); FONT-SIZE: 13px" class=Apple-style-span>
<h3 style="BORDER-BOTTOM: rgb(230,230,230) 1px solid; BORDER-LEFT: rgb(230,230,230) 1px solid; PADDING-BOTTOM: 3px; BACKGROUND-COLOR: rgb(246,246,246); MARGIN: 15px 0px 0px; PADDING-LEFT: 5px; WIDTH: 1172px; PADDING-RIGHT: 5px; FONT: 600 16px/1.2 Arial; BORDER-TOP: rgb(230,230,230) 1px solid; BORDER-RIGHT: rgb(230,230,230) 1px solid; WORD-SPACING: 3px; PADDING-TOP: 3px; border-top-left-radius: 7px 7px; border-top-right-radius: 7px 7px; border-bottom-right-radius: 7px 7px; border-bottom-left-radius: 7px 7px" class=fn>pixmap :<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qpixmap.html">QPixmap</a></h3>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">This property holds the label's pixmap.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">If no pixmap has been set this will return 0.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">Setting the pixmap clears any previous content. The buddy shortcut, if any, is disabled.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px"><strong>Access functions:</strong></p>
<table style="BORDER-BOTTOM: rgb(230,230,230) 1px solid; BORDER-LEFT: rgb(230,230,230) 1px solid; BACKGROUND-COLOR: rgb(246,246,246); MARGIN: 5px; WIDTH: 1170px; BORDER-COLLAPSE: separate; FONT-SIZE: 11px; BORDER-TOP: rgb(230,230,230) 1px solid; BORDER-RIGHT: rgb(230,230,230) 1px solid; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-top-left-radius: 7px 7px; border-top-right-radius: 7px 7px; border-bottom-right-radius: 7px 7px; border-bottom-left-radius: 7px 7px" class=alignedsummary>
    <tbody>
        <tr>
            <td style="TEXT-ALIGN: right; PADDING-BOTTOM: 3px; MARGIN: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 5px; VERTICAL-ALIGN: top; PADDING-TOP: 3px" class="memItemLeft topAlign rightAlign">const QPixmap *</td>
            <td style="PADDING-BOTTOM: 3px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 15px; PADDING-TOP: 3px" class="memItemRight bottomAlign"><strong>pixmap</strong><span class=Apple-converted-space>&nbsp;</span>() const</td>
        </tr>
        <tr>
            <td style="TEXT-ALIGN: right; PADDING-BOTTOM: 3px; MARGIN: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 5px; VERTICAL-ALIGN: top; PADDING-TOP: 3px" class="memItemLeft topAlign rightAlign">void</td>
            <td style="PADDING-BOTTOM: 3px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 15px; PADDING-TOP: 3px" class="memItemRight bottomAlign"><strong>setPixmap</strong><span class=Apple-converted-space>&nbsp;</span>( const QPixmap &amp; )</td>
        </tr>
    </tbody>
</table>
</span></span><br>3. 对QPixmap的scaled函数的解析<br><br><span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; FONT: medium Arial; WHITE-SPACE: normal; ORPHANS: 2; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=Apple-style-span><span style="LINE-HEIGHT: 15px; FONT-FAMILY: Verdana; COLOR: rgb(54,53,52); FONT-SIZE: 13px" class=Apple-style-span>
<h3 style="BORDER-BOTTOM: rgb(230,230,230) 1px solid; BORDER-LEFT: rgb(230,230,230) 1px solid; PADDING-BOTTOM: 3px; BACKGROUND-COLOR: rgb(246,246,246); MARGIN: 15px 0px 0px; PADDING-LEFT: 5px; WIDTH: 1172px; PADDING-RIGHT: 5px; FONT: 600 16px/1.2 Arial; BORDER-TOP: rgb(230,230,230) 1px solid; BORDER-RIGHT: rgb(230,230,230) 1px solid; WORD-SPACING: 3px; PADDING-TOP: 3px; border-top-left-radius: 7px 7px; border-top-right-radius: 7px 7px; border-bottom-right-radius: 7px 7px; border-bottom-left-radius: 7px 7px" class=fn>QPixmap QPixmap::scaled ( const<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qsize.html">QSize</a><span class=Apple-converted-space>&nbsp;</span>&amp;<span class=Apple-converted-space>&nbsp;</span><em>size</em>,<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qt.html#AspectRatioMode-enum">Qt::AspectRatioMode</a><span class=Apple-converted-space>&nbsp;</span><em>aspectRatioMode</em><span class=Apple-converted-space>&nbsp;</span>= Qt::IgnoreAspectRatio,<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qt.html#TransformationMode-enum">Qt::TransformationMode</a><em>transformMode</em><span class=Apple-converted-space>&nbsp;</span>= Qt::FastTransformation ) const</h3>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">Scales the pixmap to the given<span class=Apple-converted-space>&nbsp;</span><em>size</em>, using the aspect ratio and transformation modes specified by<span class=Apple-converted-space>&nbsp;</span><em>aspectRatioMode</em><span class=Apple-converted-space>&nbsp;</span>and<span class=Apple-converted-space>&nbsp;</span><em>transformMode</em>.</p>
<ul style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 25px; PADDING-RIGHT: 0px; PADDING-TOP: 10px">
    <li style="BACKGROUND-IMAGE: url(../images/bullet_sq.png); PADDING-BOTTOM: 0px; LIST-STYLE-TYPE: none; MARGIN: 0px 0px 10px; PADDING-LEFT: 12px; PADDING-RIGHT: 0px; FONT: 400 10pt/1.2 Verdana; BACKGROUND-POSITION: 0px 5px; PADDING-TOP: 0px; background-origin: initial; background-clip: initial">If<span class=Apple-converted-space>&nbsp;</span><em>aspectRatioMode</em><span class=Apple-converted-space>&nbsp;</span>is<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qt.html#AspectRatioMode-enum">Qt::IgnoreAspectRatio</a>, the pixmap is scaled to<span class=Apple-converted-space>&nbsp;</span><em>size</em>.</li>
    <li style="BACKGROUND-IMAGE: url(../images/bullet_sq.png); PADDING-BOTTOM: 0px; LIST-STYLE-TYPE: none; MARGIN: 0px 0px 10px; PADDING-LEFT: 12px; PADDING-RIGHT: 0px; FONT: 400 10pt/1.2 Verdana; BACKGROUND-POSITION: 0px 5px; PADDING-TOP: 0px; background-origin: initial; background-clip: initial">If<span class=Apple-converted-space>&nbsp;</span><em>aspectRatioMode</em><span class=Apple-converted-space>&nbsp;</span>is<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qt.html#AspectRatioMode-enum">Qt::KeepAspectRatio</a>, the pixmap is scaled to a rectangle as large as possible inside<span class=Apple-converted-space>&nbsp;</span><em>size</em>, preserving the aspect ratio.</li>
    <li style="BACKGROUND-IMAGE: url(../images/bullet_sq.png); PADDING-BOTTOM: 0px; LIST-STYLE-TYPE: none; MARGIN: 0px 0px 10px; PADDING-LEFT: 12px; PADDING-RIGHT: 0px; FONT: 400 10pt/1.2 Verdana; BACKGROUND-POSITION: 0px 5px; PADDING-TOP: 0px; background-origin: initial; background-clip: initial">If<span class=Apple-converted-space>&nbsp;</span><em>aspectRatioMode</em><span class=Apple-converted-space>&nbsp;</span>is<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qt.html#AspectRatioMode-enum">Qt::KeepAspectRatioByExpanding</a>, the pixmap is scaled to a rectangle as small as possible outside<span class=Apple-converted-space>&nbsp;</span><em>size</em>, preserving the aspect ratio.</li>
</ul>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">If the given<span class=Apple-converted-space>&nbsp;</span><em>size</em><span class=Apple-converted-space>&nbsp;</span>is empty, this function returns a null pixmap.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">In some cases it can be more beneficial to draw the pixmap to a painter with a scale set rather than scaling the pixmap. This is the case when the painter is for instance based on OpenGL or when the scale factor changes rapidly.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">See also<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qpixmap.html#isNull">isNull</a>() and<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qpixmap.html#pixmap-transformations">Pixmap Transformations</a>.</p>
<h3 style="BORDER-BOTTOM: rgb(230,230,230) 1px solid; BORDER-LEFT: rgb(230,230,230) 1px solid; PADDING-BOTTOM: 3px; BACKGROUND-COLOR: rgb(246,246,246); MARGIN: 15px 0px 0px; PADDING-LEFT: 5px; WIDTH: 1172px; PADDING-RIGHT: 5px; FONT: 600 16px/1.2 Arial; BORDER-TOP: rgb(230,230,230) 1px solid; BORDER-RIGHT: rgb(230,230,230) 1px solid; WORD-SPACING: 3px; PADDING-TOP: 3px; border-top-left-radius: 7px 7px; border-top-right-radius: 7px 7px; border-bottom-right-radius: 7px 7px; border-bottom-left-radius: 7px 7px" class=fn><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" name=scaled-2></a>QPixmap QPixmap::scaled ( int<span class=Apple-converted-space>&nbsp;</span><em>width</em>, int<span class=Apple-converted-space>&nbsp;</span><em>height</em>,<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qt.html#AspectRatioMode-enum">Qt::AspectRatioMode</a><span class=Apple-converted-space>&nbsp;</span><em>aspectRatioMode</em><span class=Apple-converted-space>&nbsp;</span>= Qt::IgnoreAspectRatio,<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qt.html#TransformationMode-enum">Qt::TransformationMode</a><em>transformMode</em><span class=Apple-converted-space>&nbsp;</span>= Qt::FastTransformation ) const</h3>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">This is an overloaded function.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">Returns a copy of the pixmap scaled to a rectangle with the given<span class=Apple-converted-space>&nbsp;</span><em>width</em><span class=Apple-converted-space>&nbsp;</span>and<span class=Apple-converted-space>&nbsp;</span><em>height</em><span class=Apple-converted-space>&nbsp;</span>according to the given<span class=Apple-converted-space>&nbsp;</span><em>aspectRatioMode</em><span class=Apple-converted-space>&nbsp;</span>and<span class=Apple-converted-space>&nbsp;</span><em>transformMode</em>.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">If either the<span class=Apple-converted-space>&nbsp;</span><em>width</em><span class=Apple-converted-space>&nbsp;</span>or the<span class=Apple-converted-space>&nbsp;</span><em>height</em><span class=Apple-converted-space>&nbsp;</span>is zero or negative, this function returns a null pixmap.</p>
</span></span>
<img src ="http://www.cppblog.com/lauer3912/aggbug/145370.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-04-29 23:02 <a href="http://www.cppblog.com/lauer3912/archive/2011/04/29/145370.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PyQt 抓图和截图操作</title><link>http://www.cppblog.com/lauer3912/archive/2011/04/29/145367.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Fri, 29 Apr 2011 14:56:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/04/29/145367.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/145367.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/04/29/145367.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/145367.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/145367.html</trackback:ping><description><![CDATA[1. 示例代码<br>self.originalPixmap = QtGui.QPixmap.grabWindow(QtGui.QApplication.desktop().winId())<br><br>2.关于QPixmap类的grabWIndow <br><span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; FONT: medium Arial; WHITE-SPACE: normal; ORPHANS: 2; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=Apple-style-span><span style="LINE-HEIGHT: 15px; FONT-FAMILY: Verdana; COLOR: rgb(54,53,52); FONT-SIZE: 13px" class=Apple-style-span>
<h3 style="BORDER-BOTTOM: rgb(230,230,230) 1px solid; BORDER-LEFT: rgb(230,230,230) 1px solid; PADDING-BOTTOM: 3px; BACKGROUND-COLOR: rgb(246,246,246); MARGIN: 15px 0px 0px; PADDING-LEFT: 5px; WIDTH: 1172px; PADDING-RIGHT: 5px; FONT: 600 16px/1.2 Arial; BORDER-TOP: rgb(230,230,230) 1px solid; BORDER-RIGHT: rgb(230,230,230) 1px solid; WORD-SPACING: 3px; PADDING-TOP: 3px; border-top-left-radius: 7px 7px; border-top-right-radius: 7px 7px; border-bottom-right-radius: 7px 7px; border-bottom-left-radius: 7px 7px" class=fn>QPixmap QPixmap::grabWindow (<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qwidget.html#WId-typedef">WId</a><span class=Apple-converted-space>&nbsp;</span><em>window</em>, int<span class=Apple-converted-space>&nbsp;</span><em>x</em><span class=Apple-converted-space>&nbsp;</span>= 0, int<span class=Apple-converted-space>&nbsp;</span><em>y</em><span class=Apple-converted-space>&nbsp;</span>= 0, int<span class=Apple-converted-space>&nbsp;</span><em>width</em><span class=Apple-converted-space>&nbsp;</span>= -1, int<span class=Apple-converted-space>&nbsp;</span><em>height</em><span class=Apple-converted-space>&nbsp;</span>= -1 )<tt style="WORD-SPACING: 5px"><span class=Apple-converted-space>&nbsp;</span>[static]</tt></h3>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">Creates and returns a pixmap constructed by grabbing the contents of the given<span class=Apple-converted-space>&nbsp;</span><em>window</em><span class=Apple-converted-space>&nbsp;</span>restricted by<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qrect.html">QRect</a>(<em>x</em>,<span class=Apple-converted-space>&nbsp;</span><em>y</em>,<span class=Apple-converted-space>&nbsp;</span><em>width</em>,<span class=Apple-converted-space>&nbsp;</span><em>height</em>).</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">The arguments (<em>x</em>,<span class=Apple-converted-space>&nbsp;</span><em>y</em>) specify the offset in the window, whereas (<em>width</em>,<span class=Apple-converted-space>&nbsp;</span><em>height</em>) specify the area to be copied. If<span class=Apple-converted-space>&nbsp;</span><em>width</em><span class=Apple-converted-space>&nbsp;</span>is negative, the function copies everything to the right border of the window. If<span class=Apple-converted-space>&nbsp;</span><em>height</em><span class=Apple-converted-space>&nbsp;</span>is negative, the function copies everything to the bottom of the window.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">The window system identifier (<tt style="WORD-SPACING: 5px">WId</tt>) can be retrieved using the<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qwidget.html#winId">QWidget::winId</a>() function. The rationale for using a window identifier and not a<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qwidget.html">QWidget</a>, is to enable grabbing of windows that are not part of the application, window system frames, and so on.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">The grabWindow() function grabs pixels from the screen, not from the window, i.e. if there is another window partially or entirely over the one you grab, you get pixels from the overlying window, too. The mouse cursor is generally not grabbed.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">Note on X11 that if the given<span class=Apple-converted-space>&nbsp;</span><em>window</em><span class=Apple-converted-space>&nbsp;</span>doesn't have the same depth as the root window, and another window partially or entirely obscures the one you grab, you will<span class=Apple-converted-space>&nbsp;</span><em>not</em><span class=Apple-converted-space>&nbsp;</span>get pixels from the overlying window. The contents of the obscured areas in the pixmap will be undefined and uninitialized.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px">On Windows Vista and above grabbing a layered window, which is created by setting the<span class=Apple-converted-space>&nbsp;</span><a style="COLOR: rgb(0,115,47); TEXT-DECORATION: none" href="http://www.cppblog.com/lauer3912/admin/qt.html#WidgetAttribute-enum">Qt::WA_TranslucentBackground</a><span class=Apple-converted-space>&nbsp;</span>attribute, will not work. Instead grabbing the desktop widget should work.</p>
<p style="PADDING-BOTTOM: 5px; LINE-HEIGHT: 20px; MARGIN: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px"><strong>Warning:</strong><span class=Apple-converted-space>&nbsp;</span>In general, grabbing an area outside the screen is not safe. This depends on the underlying window system.</p>
</span></span>
<img src ="http://www.cppblog.com/lauer3912/aggbug/145367.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-04-29 22:56 <a href="http://www.cppblog.com/lauer3912/archive/2011/04/29/145367.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>