#coding = utf-8import osstr1 = 'd:/v3/'str2 = 'd:/v3/'fobj = open('D:/V3/txt/1.txt','rb')line = fobj.readline()while line: if(line.find('a') > 0):...
分类:
其他好文 时间:
2014-06-25 23:22:26
阅读次数:
270
I can feel that I am making great progress now.. if inspected closely, it is obvious that what I'm getting through is, a newbie phase:coding details m...
分类:
其他好文 时间:
2014-06-25 18:23:24
阅读次数:
206
KVC/KVO1 KVC/KVO2 线程(GCP)
分类:
其他好文 时间:
2014-06-25 12:40:23
阅读次数:
109
monkey patch (猴子补丁) 用来在运行时动态修改已有的代码,而不需要修改原始代码。简单的monkey patch 实现:[python]#coding=utf-8def originalFunc(): print 'this is original function!'def modif...
分类:
编程语言 时间:
2014-06-24 22:50:22
阅读次数:
463
python社区不乏幽默,先来看“python之道”这首诗。
导入this包:
import this
输出时一首诗,这首诗总结了Python的风格,可以指导Python程序员的编程。下面是译文:
The Zen of Python, by Tim Peters
Python之道
Beautiful is better than ugly.
美观胜于丑陋。
Explicit i...
分类:
编程语言 时间:
2014-06-24 22:40:23
阅读次数:
295
看到一篇博文写lambda和reduce函数,笔者小痒了一下,用Python实现一下:
#! /usr/bin/env python
# -*-coding:utf-8-*-
import time
import math
def test_reduce():
start_time = time.clock()
print reduce[A1] (lam...
分类:
编程语言 时间:
2014-06-24 20:37:10
阅读次数:
272
题目
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Have you thought about this?
Here are some good questions to ask before coding. Bonus poin...
分类:
其他好文 时间:
2014-06-24 20:16:39
阅读次数:
180
heapq模块实现了python中的堆排序,并提供了有关方法。让用Python实现排序算法有了简单快捷的方式。
heapq的官方文档和源码:8.4.heapq-Heap queue algorithm
下面通过举例的方式说明heapq的应用方法
实现堆排序
#! /usr/bin/evn python
#coding:utf-8
from heapq import *
def ...
分类:
编程语言 时间:
2014-06-24 18:47:47
阅读次数:
403
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for y...
分类:
其他好文 时间:
2014-06-22 09:31:16
阅读次数:
220
在Bootstrap中使用
$url = constant ( "APPLICATION_PATH" ) . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . 'application.ini';
$dbconfig = new Zend_Config_Ini ( $url, "mysql" );
// $db = Zen...
分类:
数据库 时间:
2014-06-22 07:52:08
阅读次数:
205