#-*-coding:utf-8-*-#python:2.x__author__='Administrator'#超类01#它是一个内建类型,用于访问属于某个对象超类特性printsuper##如果已习惯于通过直接调用父类将self作为第一参数来访问的特性,可能会出现混乱#经典方法classM(ob...
分类:
编程语言 时间:
2014-08-21 18:57:04
阅读次数:
310
一 字符串中的用法1。地球人都知道 C# 中 字符串常量可以以 @ 开头声名,这样的优点是转义序列“不”被处理,按“原样”输出,即我们不需要对转义字符加上 \ (反斜扛),就可以轻松coding。如,[csharp]view plaincopyprint?stringfilePath=@"c:\Do...
分类:
其他好文 时间:
2014-08-21 16:50:34
阅读次数:
190
Implement an algorithm to print all valid combinations of n-pairs of parentheses#includevoid f(int idx,int left,int right,char *buf){ if(left == 0 ...
分类:
其他好文 时间:
2014-08-21 13:06:34
阅读次数:
168
Given a infinite number of quarters(25cents), dimens(10cents), nickels(5cents) and pennies(1cent), write code to calculate the number of ways of repre...
分类:
其他好文 时间:
2014-08-21 12:56:04
阅读次数:
260
#coding=gbkfromPyQt4importQtGui,QtCoreimportrandomclassMyWidget(QtGui.QWidget):def__init__(self,parent=None):ifparentisNone:self.app=QtGui.QApplicatio...
分类:
其他好文 时间:
2014-08-21 11:23:43
阅读次数:
220
#coding=gbkfromPyQt4importQtGui,QtCore#-------------------------------------------------------------------#ListConfirm提供一个对列表项进行应答或确认的GUI接口#----------...
分类:
其他好文 时间:
2014-08-21 11:17:43
阅读次数:
155
#-*-coding:utf-8-*-#python:2.x__author__='Administrator'#类级#在2.2中,提出了类型(type0与类(class)统一(请访问:https://www.python.org/download/releases/2.2.3/descintro(...
分类:
编程语言 时间:
2014-08-20 23:58:53
阅读次数:
521
from__future__importwith_statement#-*-coding:utf-8-*-#python:2.x__author__='Administrator'#with和contextlib#对于要确保即使发生一个错误时也能运行一些清理代码而言,try...finally语句很...
分类:
编程语言 时间:
2014-08-20 22:26:32
阅读次数:
282
#-*-coding:utf-8-*-#python:2.x__author__='Administrator'#装饰器01#特点是:使得函数和方法封装(接收一个函数并返回增强版本一个函数)#语法:原始场景可以将方法在定义首部将其定义为类方法或者静态方法,在未使用装饰器之前,语法如下:classWh...
分类:
编程语言 时间:
2014-08-20 19:22:42
阅读次数:
267
#-*-coding:utf-8-*-#python:2.x__author__='Administrator'#生成器表达式和itertools模块#yield中可以使用圆括号代替中括号iter0=(x**2forxinrange(10)ifx%2==0)foriter1initer0:print...
分类:
编程语言 时间:
2014-08-20 17:54:52
阅读次数:
221