摘要: 通常情况下,如果我们要使用一个类的方法,那我们只能将一个类实体化成一个对象,进而调用对象使用方法。比如: class Hello(object): def __init__: ... def print_hello(self): print "Hello" 要用 ... 阅读全文
posted @ 2014-06-05 15:04 打个西瓜 阅读(161) 评论(0) 推荐(0) 编辑
摘要: def _wrap_with(code): def inner(text, bold=False): c = code if bold: c = "1;%s" % c return "\033[%sm%s\033[0m" % (c, text) return innerred = _wrap_with('31')green = _wrap_with('32')yellow = _wrap_with('33')blue = _wrap_with('34')magenta = _wrap_wit 阅读全文
posted @ 2013-09-04 10:11 打个西瓜 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 第一章#include <stdio.h>int main(void){ printf("hello, world\n"); return 0;} #include <stdio.h>int main(void){ printf("parkinson's law:\nwork expand so as to "); printf("fill the time \n"); printf("available for its completion.\n"); return 0;}#inc 阅读全文
posted @ 2012-11-13 22:17 打个西瓜 阅读(156) 评论(0) 推荐(0) 编辑