<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>真好吃 &#187; Python</title>
	<atom:link href="http://tgic.me/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://tgic.me</link>
	<description>blog真的很好吃</description>
	<lastBuildDate>Sun, 01 Jan 2012 17:31:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>淘宝宝 短域名</title>
		<link>http://tgic.me/2010/11/14/%e6%b7%98%e5%ae%9d%e5%ae%9d-%e7%9f%ad%e5%9f%9f%e5%90%8d/</link>
		<comments>http://tgic.me/2010/11/14/%e6%b7%98%e5%ae%9d%e5%ae%9d-%e7%9f%ad%e5%9f%9f%e5%90%8d/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 14:56:01 +0000</pubDate>
		<dc:creator>T.G.</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://farmer1992.phpsix.net/?p=848</guid>
		<description><![CDATA[淘宝宝 短域名 http://tao.bb/ 目标：改变 很长 很长 很长 的 淘宝商品 网址 源代码 http://code.google.com/p/taobb/ 欢迎你的建议 更欢迎你的加入]]></description>
			<content:encoded><![CDATA[<p>淘宝宝 短域名</p>
<p><span style="font-size: x-large;"><a id="url_1" href="http://tao.bb/" target="_blank">http://tao.bb/</a></p>
<p>目标：改变 很长 很长 很长 的 淘宝商品 网址</span></p>
<p>源代码<br />
<a id="url_2" href="http://code.google.com/p/taobb/" target="_blank">http://code.google.com/p/taobb/</a></p>
<p>欢迎你的建议<br />
更欢迎你的加入</p>
]]></content:encoded>
			<wfw:commentRss>http://tgic.me/2010/11/14/%e6%b7%98%e5%ae%9d%e5%ae%9d-%e7%9f%ad%e5%9f%9f%e5%90%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>编写python c++ 扩展 (ubuntu下)</title>
		<link>http://tgic.me/2009/12/19/%e7%bc%96%e5%86%99python-c-%e6%89%a9%e5%b1%95-ubuntu%e4%b8%8b/</link>
		<comments>http://tgic.me/2009/12/19/%e7%bc%96%e5%86%99python-c-%e6%89%a9%e5%b1%95-ubuntu%e4%b8%8b/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 15:49:24 +0000</pubDate>
		<dc:creator>T.G.</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://farmer1992.phpsix.net/?p=670</guid>
		<description><![CDATA[python 的c++扩展编写 比 php简单很多 phpize 也不是很好用的一个东西 编写一个 python mod hello world 123456789101112131415161718192021222324#include &#34;Python.h&#34; PyObject* hello&#40;PyObject* self, PyObject* args&#41;&#123; &#160; &#160; const char * str; &#160; &#160; &#160; &#160; if &#40;! PyArg_ParseTuple&#40;args, &#34;s&#34;, &#38;str&#41;&#41; &#160; &#160; &#160; &#160; return NULL; &#160; &#160; &#160; &#160; return Py_BuildValue&#40;&#34;s&#34;,str&#41;; &#125; static PyMethodDef helloMethods&#91;&#93; = &#123; &#160; &#160; &#123;&#34;hello&#34;, hello, [...]]]></description>
			<content:encoded><![CDATA[<p>python 的c++扩展编写 比 php简单很多</p>
<p>phpize 也不是很好用的一个东西</p>
<p>编写一个 python mod hello world</p>
<div class="codecolorer-container cpp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br /></div></td><td><div class="cpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339900;">#include &quot;Python.h&quot;</span><br />
<br />
PyObject<span style="color: #000040;">*</span> hello<span style="color: #008000;">&#40;</span>PyObject<span style="color: #000040;">*</span> self, PyObject<span style="color: #000040;">*</span> args<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span> str<span style="color: #008080;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span> PyArg_ParseTuple<span style="color: #008000;">&#40;</span>args, <span style="color: #FF0000;">&quot;s&quot;</span>, <span style="color: #000040;">&amp;</span>str<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span><br />
<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0000ff;">return</span> Py_BuildValue<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;s&quot;</span>,str<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />
<span style="color: #008000;">&#125;</span><br />
<br />
<br />
<br />
<span style="color: #0000ff;">static</span> PyMethodDef helloMethods<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><span style="color: #FF0000;">&quot;hello&quot;</span>, hello, METH_VARARGS, <span style="color: #FF0000;">&quot;hello comments&quot;</span><span style="color: #008000;">&#125;</span>,<br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><span style="color: #0000ff;">NULL</span>, <span style="color: #0000ff;">NULL</span>, <span style="color: #0000dd;">0</span>, <span style="color: #0000ff;">NULL</span><span style="color: #008000;">&#125;</span><br />
<br />
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span><br />
<br />
PyMODINIT_FUNC inithello<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; Py_InitModule<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;hello&quot;</span>, helloMethods<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />
<span style="color: #008000;">&#125;</span></div></td></tr></tbody></table></div>
<p>一个Python mod 因该有几个部分<br />
1 扩展函数 hello<br />
PyObject* hello(PyObject* self, PyObject* args){<br />
只能是这样的结构<br />
PyArg_ParseTuple 处理参数</p>
<p>2 函数列表 helloMethods<br />
static PyMethodDef helloMethods</p>
<p>3 初始化函数 inithello<br />
init函数名</p>
<p>编译<br />
在 ubuntu 下需要安装python-dev<br />
sudo apt-get install python-dev</p>
<p>yum服务器上应该是<br />
python-devel</p>
<div class="codecolorer-container make default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="make codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">all<span style="color: #004400;">:</span> hello<span style="color: #004400;">.</span>so <br />
<br />
hello<span style="color: #004400;">.</span>so<span style="color: #004400;">:</span> hello<span style="color: #004400;">.</span>o<br />
&nbsp; &nbsp; g<span style="color: #004400;">++</span> <span style="color: #004400;">-</span>shared hello<span style="color: #004400;">.</span>o <span style="color: #004400;">-</span>o hello<span style="color: #004400;">.</span>so <br />
<br />
hello<span style="color: #004400;">.</span>o<span style="color: #004400;">:</span> hello<span style="color: #004400;">.</span>cpp<br />
&nbsp; &nbsp; g<span style="color: #004400;">++</span> <span style="color: #004400;">-</span>fPIC <span style="color: #004400;">-</span>c <span style="color: #004400;">-</span>I <span style="color: #004400;">/</span>usr<span style="color: #004400;">/</span><span style="color: #666622; font-weight: bold;">include</span><span style="color: #004400;">/</span>python2<span style="color: #004400;">.</span>6<span style="color: #004400;">/</span> <span style="color: #004400;">-</span>o hello<span style="color: #004400;">.</span>o hello<span style="color: #004400;">.</span>cpp<br />
<br />
clean<span style="color: #004400;">:</span><br />
&nbsp; &nbsp; rm <span style="color: #004400;">-</span>f hello<span style="color: #004400;">.</span>o hello<span style="color: #004400;">.</span>so</div></td></tr></tbody></table></div>
<p>使用<br />
写一个 test.py</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">import</span> hello<br />
<br />
<span style="color: #ff7700;font-weight:bold;">print</span> hello.<span style="color: black;">hello</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'world'</span><span style="color: black;">&#41;</span></div></td></tr></tbody></table></div>
<p>python 运行时候 会加载当前目录的.so</p>
]]></content:encoded>
			<wfw:commentRss>http://tgic.me/2009/12/19/%e7%bc%96%e5%86%99python-c-%e6%89%a9%e5%b1%95-ubuntu%e4%b8%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>python hello</title>
		<link>http://tgic.me/2009/04/19/python-hello/</link>
		<comments>http://tgic.me/2009/04/19/python-hello/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 19:51:01 +0000</pubDate>
		<dc:creator>T.G.</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://farmer1992.phpsix.net/?p=387</guid>
		<description><![CDATA[自 php以来 新征服的语言就是 lua了 不过感觉这个东西不怎么吃香 不知道什么原因 大家都在退 python我也投降了 第一个 python 程序是声称 一个 5万条mysql语句的脚本 速度真快 不知道是 python 快还是神气的 linux快 其实能适应 命令行的生活 linux是一个很好的东西 ubuntu 还有点傻 不过我这样的人已经不错了 打破 linux 使用时间记录了 坚持 并等待胜利]]></description>
			<content:encoded><![CDATA[<p>自 php以来 新征服的语言就是 lua了<br />
不过感觉这个东西不怎么吃香<br />
不知道什么原因</p>
<p>大家都在退 python我也投降了<br />
第一个 python 程序是声称 一个 5万条mysql语句的脚本<br />
速度真快<br />
不知道是 python 快还是神气的 linux快</p>
<p>其实能适应 命令行的生活 linux是一个很好的东西<br />
ubuntu 还有点傻 不过我这样的人已经不错了</p>
<p>打破 linux 使用时间记录了 坚持 并等待胜利</p>
]]></content:encoded>
			<wfw:commentRss>http://tgic.me/2009/04/19/python-hello/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

