i, Developer!

个人资料

harmony.relax

搜索

文章分类

  • Linux应用[110]
  • perl[10]
  • 算法[5]
  • Windows应用[19]
  • Vim[2]
  • 信息安全[8]
  • 其他杂项[6]
  • html & xml[2]
  • options[2]
  • python[19]

最新评论

  • aa:For security reasons, this p...
  • Chanel Watches:初来乍到,赞一下!!!!...
  • Kanito:很好,依法修改成功!感谢您的文章! FireFox...
  • Loaden:非常好!贊一下作者,謝謝了!...
  • aa:多谢分享
  • 11:您好,我的按照您说的安了,但是就是不能升级,说是要用户名...
  • sunny:万分感谢!!
  • doubei:确实可以,在网上找了很久,终于找到可用的升级服务器了,万...
  • 超赞:超赞
  • 胡:我也试过,还是不行,大侠再支哈招! 多谢~...

管理

  • 进入后台 写新日志
  • 文章管理 评论管理
  • 更换模板 访问统计
  • 访问统计:
  • RSS 什么是RSS?
    用IM提醒我内容更新
    订阅到QQ邮箱
    订阅到鲜果阅读器
    订阅到Google阅读器
    订阅到抓虾阅读器
  • 《城客》第四期:创意之城
    博客大巴
    博客大巴使用指南
    博客大巴模板中心
    免费注册博客大巴
    一键博客搬家工具
    中文互动杂志城客

Harmony and Relax

  • yield 的简单解释 - [python]

    2008-06-17

    yield就相当于往一个list中塞东西而已(初步这么感觉),只不过写法很奇怪罢了。呵呵

    >>> def kk(x):
    ...     yield x
    ...     yield x+7
    ...     yield x*2
    ...
    >>> b = kk(14)
    &g...
    Tag:
    harmony.relax 发表于23:36:52 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • 1.1 A Simple Example - [python]

    2008-03-07

    1.1 A Simple Example Extending and Embedding the Python Interpreter Previous: 1. Extending Python with Up: 1. Extending Python with Next: 1.2 Intermezzo: Errors and
    1.1 A Simple Example ...
    Tag:
    harmony.relax 发表于14:43:47 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • How to define process in python - [python]

    2008-02-29

    when we run python script, such as a.py, we always see the process (eg: ps -A) is "python", not "a.py", how to solve it:
    #!/usr/bin/env python
    procname = 'Hello'

    import os, sys
    if not os.environ.has_key('N...
    Tag:
    harmony.relax 发表于09:47:17 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • python 中如何替换隐含字符 - [python]

    2008-02-15

     比如这么一句:^A Why miss out?^B^R^P
    那些^A, ^B这些什么隐含字符其实是我parse网页后留下的,现在想把这些隐含字符给替换替换掉(或者削掉)
    以前用perl是可以这样的:
    $str =~ s/[\cA-\cI\cK\cL\cN-\cZ]//gi;
    于是就得到Why miss out?了
    现在得用python完成这一替换,尝试了一下:re.compile(r"[\cA-\c...
    Tag:
    harmony.relax 发表于12:06:45 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • python tip: 删除非空目录 - [python]

    2008-02-05

    def RemoveNonNullDirectory (top):
        """
        Remove non-null directory
        """
        while 1:
            ...
    Tag:
    harmony.relax 发表于15:49:34 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • python switch - [python]

    2008-01-08

    # This class provides the functionality we want. You only need to look at
    # this if you want to know how this works. It only needs to be defined
    # once, no need to muck around with its internals.
    class switch(object):
    def __init...
    Tag:
    harmony.relax 发表于09:04:25 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • Python Tips : 判断两个文件是否相同 - [python]

    2008-01-07

    python中提供了很便捷的方法来判断两个文件的内容是否相同,只要两行代码:
    import filecmp
    filecmp.cmp(r'e:\1.txt',r'e:\2.txt')
    如果两个文件相同,会输出True,否则会输出false。
    Tag:
    harmony.relax 发表于21:17:03 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • Unicode strings to ASCII in python - [python]

    2007-12-28

    This has been a problem for a long time for me. Whenever someone enters a title in my CMS the id of the document is derived from the title. Spaces are replaced with '- and &' is replaced with and etc. The final thing I wanted to do was to make s...
    Tag:
    harmony.relax 发表于08:59:47 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • python fp函数 - [python]

    2007-12-19

    出于适当的需要,有几种通常在功能性语言和Lisp中出现的功能加入到了Python。通过lambda关键字,可以创建很小的匿名函数。这里有一个函数返回它的两个参数的和:“lambda a, b: a+b”。 Lambda 形式可以用于任何需要的函数对象。出于语法限制,它们只能有一个单独的表达式。语义上讲,它们只是普通函数定义中的一个语法技巧。类似于嵌套函数定义,lambda形式可以从包含范围内引用变量:

    语法: lambda argument1, ar...
    Tag:
    harmony.relax 发表于10:15:54 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • Python函数参数中的*,** - [python]

    2007-12-19

    问题:
         Python的函数定义中有两种特殊的情况,即出现*,**的形式。
         如:def myfun1(username, *keys)或def myfun2(username, **keys)等。

    解释:
      * 用来传递任意个无名字参数,这些参数会一个Tuple的形式访问。

       **用来处理传递任...
    Tag:
    harmony.relax 发表于09:49:58 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • 3.9 File Objects - [python]

    2007-12-18

    3.9 File Objects File objects are implemented using C's stdio package and can be created with the built-in constructor file() described in section 2.1, ``Built-in Functions.''3.6 File objects are also returned by some other bu...
    Tag:
    harmony.relax 发表于14:55:05 | 阅读全文 | 评论 2 | 编辑 | 分享 0
  • python 正则表达式 tips - [python]

    2007-12-18

    ###########################################################
    特殊字符:
    ###########################################################
    "." 匹配除 "\n" 之外的任何单个字符。要匹配包括 '\n' 在内的任何字符,请使用象 '[.\n]' 的模式。
    "^&quot...
    Tag:
    harmony.relax 发表于13:34:31 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • 3.6.1 String Method - [python]

    2007-12-18

    3.6.1 String Methods These are the string methods which both 8-bit strings and Unicode objects support:

    8 -bit字符串和unicode对象支持这些字符串方法

     

    capitalize( ) Return a copy of the string with only its fi...
    Tag:
    harmony.relax 发表于13:29:41 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • 4.1.1 String constants - [python]

    2007-12-18

    原文:http://docs.python.org/lib/node39.html
     4.1.1 String constants 

    The constants defined in this module are:

    该模块包含这些常量:

     

    ascii_letters The concatenation of the ascii_lowerc...
    Tag:
    harmony.relax 发表于11:36:25 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • python 得到shell命令的结果 - [python]

    2007-12-12

    import os
    str = os.popen("dir").read()
    a = str.split("\n")
    for b in a:
       print b
    Tag:
    harmony.relax 发表于15:48:37 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • 怎样在python中判断一个文件是否存在 - [python]

    2007-12-12

    import   os  
      path   =   'c:\windows'  
      e   =   os.path.exists(path)  
      print   e     #   True

     那如果是要判断文件而不是目录呢?

     os.p...
    Tag:
    harmony.relax 发表于00:15:11 | 阅读全文 | 评论 0 | 编辑 | 分享 0
  • Python如何操控内存buffer? - [python]

    2007-12-09

    和C字符串不同,Python字符串不能改写。按字符串索引赋值会产生错误。

    >>> word[0] = 'x'
    Traceback (most recent call last):
    File "", line 1, in ?
    TypeError: object doesn't support item assignment
    >>> word[:1]...
    Tag:
    harmony.relax 发表于18:52:45 | 阅读全文 | 评论 0 | 编辑 | 分享 0
共1页 1
Copyright © 2002-2012 BlogBus.com, All Rights Reserved. 博客大巴 版权所有
博客大巴模板设计:i,Developer! | 作者: Innocent Sin