博客首页
注册
建议与交流
排行榜
加入友情链接
推荐
投诉
搜索:
帮助
OpenBSD
Don't think what you can do Think what you could do
atyu30.cublog.cn
管理博客
发表文章
留言
收藏夹
· learn
· news
· Tool
博客圈
音乐
· flash
· s80
相册
· BSD
· CAR
· Desk
文章
· OpenBSD_01
· OpenBSD_02
· Script
· MYSQL
· Mail
· Linux
· LDAP
· OpenBSD_03
· 虚拟化
· Leisure
首页
关于作者
Talk: iopenbsd#gmail.com 协助测试、实施基于 OpenBSD/RHEL 的Mail Server
||
<<
>>
||
我的分类
文章列表 - Script
PHP生成Excel
PHP生成Excel报表<br><br><?php<br> $path = '/usr/share/pear'; // 你自定义的 PEAR 路径<br> set_include_path(get_include_path() . PATH_SEPARATOR . $path); // 设置 PHP 环境变量路径为除 php.in……
查看全文
发表于:2008-09-01 ┆
阅读(219)
┆
评论(0)
与Web2Py共舞
<div id="bd"> <div id="yui-main"> <div class="yui-b"> <div id="chapter-body"> <div class="document"> <div class="section"> <h1 class="cn" id="cn0">Rolling with web2py</h……
查看全文
发表于:2008-03-23 ┆
阅读(671)
┆
评论(0)
删除创建时间超过7天的文件
<DIV><SPAN chatIndex="purpleb684859b">find /tmp -atime +7 | xargs rm -rf {}</SPAN></DIV> <DIV> </DIV> <DIV></DIV> <DIV></DIV>
查看全文
发表于:2008-03-12 ┆
阅读(390)
┆
评论(0)
使用FCKeditor编辑器上传文件时中文文件名乱码
使用UTF-8编码时,FCKeditor编辑器上传文件时中文文件名乱码<br>修改:<span style="font-weight: bold;">editor\filemanager\browser\default\frmupload.html</span> 文件的编码改为<span style="font-weight: ……
查看全文
发表于:2008-01-04 ┆
阅读(777)
┆
评论(0)
sed修改原文
<span style="color: rgb(255, 1, 2);"><span style="color: rgb(0, 1, 2);">shell中直接删除原文行有abc的行</span></span><br># sed <span style="color: rgb(255, 1, 2);">-i <span style="color: rgb(0, 1, 2);"……
查看全文
发表于:2008-01-03 ┆
阅读(549)
┆
评论(0)
python class
<DIV><SPAN class=application>Python</SPAN> 是完全面向对象的:你可以定义自已的类,从自已的或内置的类继承,然后从你定义的类创建实例。</DIV> <DIV>class Atyu30:</DIV> <DIV> ……
查看全文
发表于:2007-11-17 ┆
阅读(378)
┆
评论(0)
得到邮件组件和Metadata的函数
fetchAll()<br>fetchBody()<br>fetchBodyStructure()<br>fetchEnvelope()<br>fetchHeaders()<br>fetchMessage()<br>fetchSimplifiedBody()<br>fetchSpecific()<br>
查看全文
发表于:2007-11-14 ┆
阅读(369)
┆
评论(0)
imaplib
imaplib模块
查看全文
发表于:2007-11-13 ┆
阅读(358)
┆
评论(0)
标准ping程序的python实现
#!/usr/bin/env python<br># -*- coding: iso-8859-1 -*-<br>"""ping.py<br> <br> ping.py uses the ICMP protocol's mandatory ECHO_REQUEST<br> datagram to elicit an ICMP ECHO_RESPONSE from a<……
查看全文
发表于:2007-11-11 ┆
阅读(528)
┆
评论(0)
模块导入的搜索路径
<pre class="screen"><tt class="prompt">>>> </tt><span class="userinput"><span class="pykeyword">import</span> sys</span> <a name="odbchelper.objects.2.1"></a><img src="http://……
查看全文
发表于:2007-11-10 ┆
阅读(414)
┆
评论(0)
为什么是两个下划线
所有的函数都有一个内置的 __doc__ 属性,它会返回在函数源代码中定义的 doc string<br>如果一个 <span class="application">Python</span> 函数,类方法,或属性的名字以两个下划线开始 (但不是结束),它是私有的;……
查看全文
发表于:2007-11-10 ┆
阅读(377)
┆
评论(0)
私有函数
<DIV>一个 <SPAN class=application>Python</SPAN> 函数,方法,或属性是私有还是公有,完全取决于它的名字。 <P>如果一个 <SPAN class=application>Python</SPAN> 函数,类方法,或属性的名字以两个下划线开始 (但……
查看全文
发表于:2007-11-10 ┆
阅读(391)
┆
评论(0)
了解何时去使用 self 和 __init__
<DIV>当定义你自已的类方法时,你<SPAN class=emphasis><EM>必须</EM></SPAN> 明确将 <TT class=literal><FONT face=新宋体>self</FONT></TT> 作为每个方法的第一个参数列出,包括 <TT class=function><FONT face=新……
查看全文
发表于:2007-11-10 ┆
阅读(387)
┆
评论(0)
导入模块的方法
Python 有两种导入模块的方法。<br>import module<br>from module import<br>
查看全文
发表于:2007-11-09 ┆
阅读(369)
┆
评论(0)
ljust 方法介绍
>>> s = 'buildConnectionString'<br>>>> s.ljust(30)<br>'buildConnectionString '<br>>>> s.ljust(20)<br>'buildConnectionString'<……
查看全文
发表于:2007-11-09 ┆
阅读(365)
┆
评论(0)
split 不带参数
>>> s = "this is\natyu30's\ttest"<br>>>> print s<br>this is<br>atyu30's test<br>>>> print s.split()<b……
查看全文
发表于:2007-11-09 ┆
阅读(389)
┆
评论(0)
安全使用 and-or 技巧
>>> a = ""<br>>>> b = "second"<br>>>> (1 and [a] or [b])[0]<br>''<br> 由于 [a] 是一个非空列表,所以它决不会为假。即使 a 是 0 或者 '' 或者其它假值,列表 [a]<br> 也……
查看全文
发表于:2007-11-09 ┆
阅读(369)
┆
评论(0)
and 和 or 的特殊性质
>>> 'a' and 'b'<br>'b'<br>>>> '' and 'b'<br>''<br>>>> '' and 'b' and 'c'<br>''<br>>>> 'a' and 'b' and 'c'<br>'c'<br>>>> <br>使用 and 时,在布尔环境中从左到……
查看全文
发表于:2007-11-09 ┆
阅读(404)
┆
评论(0)
列表过滤
>>> li = ["a","mpilgrim","foo","b","c","b","d","d"]<br>>>> [elem for elem in li if len(elem) > 1]<br>['mpilgrim', 'foo']<br>>>> [elem for elem in li if li.count(elem)……
查看全文
发表于:2007-11-09 ┆
阅读(323)
┆
评论(0)
通过 getattr 获取对象引用
使用 getattr 函数,可以得到一个直到运行时才知道名称的函数的引用。<br>>>> li = ["Larry","Curly"]<br>>>> li.pop<br><built-in method pop of list object at 0x868f84cc><br>>>&……
查看全文
发表于:2007-11-09 ┆
阅读(328)
┆
评论(0)
List 解析
>>> li = [2,9,8,6]<br>>>> [elem*2 for elem in li]<br>[4, 18, 16, 12]<br>>>> li<br>[2, 9, 8, 6]<br>>>> <br>为了便于理解它,让我们从右向左看。li 是一个将要映射的 ……
查看全文
发表于:2007-11-09 ┆
阅读(464)
┆
评论(0)
格式化字符串
将一个值插入到一个有字符串格式符 %s 的字符串中。<br>>>> k = "uid"<br>>>> v = "atyu30"<br>>>> "%s=%s" % (k,v)<br>'uid=atyu30'<br>>>> <br><br>即是格式化字符串,也……
查看全文
发表于:2007-11-09 ┆
阅读(426)
┆
评论(0)
DNS 查询
<table style="border: 1px solid rgb(153, 153, 153); width: 600px; font-size: 12px; height: 120px;" align="center"><tbody><tr><td> #!/usr/bin/env python<br>import sys, socket<br>result = soc……
查看全文
发表于:2007-11-08 ┆
阅读(488)
┆
评论(0)
Dictionary 介绍
Dictionary 是 <span class="application">Python</span> 的内置数据类型之一,它定义了键和值之间一对一的关系。<br><span class="application"> Python</span> 中的 dictionary 就像 <span class="applicati……
查看全文
发表于:2007-11-05 ┆
阅读(431)
┆
评论(0)
代码缩进
<span class="application">Python</span> 函数没有明显的 <tt class="literal">begin</tt> 和 <tt class="literal">end</tt>,没有标明函数的开始和结束的花括号。唯一的分隔符是一个冒号 (<tt class="literal">:</……
查看全文
发表于:2007-10-25 ┆
阅读(406)
┆
评论(0)