1.1定制类1.1.1__str__>>>classStudent(object):...def__init__(self,name):...self.name=name...>>>s=Student(‘daidai‘)>>>s.name‘daidai‘>>>Student(‘daidai‘).name‘daidai‘>>>print(Student(‘daidai‘))--发现这样打印并不好看..
分类:
编程语言 时间:
2016-07-14 07:15:03
阅读次数:
243
方程:z^6-1=0; %f为求解的方程,df是导数,使用的时候用funchandler定义 %res是目标分辨率,iter是循环次数,(xc,yc)是图像的中心,xoom是放大倍数 %参数视自己需求增加或减少 function newton(f,df,res,iter,xc,yc,xoom) %一 ...
分类:
其他好文 时间:
2016-07-13 08:03:49
阅读次数:
300
上述代码编译运行皆没有问题,但是用valgrind检测会提示错误: Why? 此代码可以实现功能要求,但是健壮性并不好,假设在map.erase之后再次使用map当前的iterator,即 代码运行就会出现错误,因为it目前指向的对象已经被删掉了。 为了避免程序出现这样的错误,我们应该保证在iter ...
分类:
其他好文 时间:
2016-07-07 22:27:40
阅读次数:
266
1.迭代器:对象在其内部实现了iter(),__iter__()方法,可以用next方法实现自我遍历。 二.python正则表达式1.python通过re模块支持正则表达式2.查看当前系统有哪些python模块:help('modules') help():交互式模式,支持两种方式调用(交互式模式调 ...
分类:
编程语言 时间:
2016-07-04 10:10:08
阅读次数:
207
一. python反射的方式来调用方法属性 二. python类的一些注意点 1. 父类的方法里面用到子类的属性方法;其实是子类才会调用实例化调用父类的这个方法,所以不会出错 2. 特殊方法 __call__, 3. 特殊方法__iter__ 4. property, XXX.setter装饰器 ...
分类:
编程语言 时间:
2016-07-03 11:54:33
阅读次数:
163
使用特殊方法实现字典 iter方法 super方法 有序字典实现 python单例模式 ...
分类:
编程语言 时间:
2016-07-02 00:33:09
阅读次数:
207
第一种: Map map = new HashMap(); Iterator iter = map.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); Object ke ...
分类:
其他好文 时间:
2016-06-30 16:30:45
阅读次数:
189
int CRuntimePara::getInt(const string& strKey,int iDefault){ map<string,string>::const_iterator iter; if ((iter = _mapParaValue.find(strKey)) != _mapP ...
分类:
编程语言 时间:
2016-06-30 12:43:28
阅读次数:
134
using namespace std; std::map<int,int> m_map; 1、添加 for(int i=0;i<10;i++) { m_map.insert(make_pair(i,i)); } 2、修改 std::map<int,int>::iterator iter; for( ...
分类:
其他好文 时间:
2016-06-27 12:11:39
阅读次数:
180
hasNext() 方法是检查序列中是否还有元素。 remove()方法是将迭代器返回的元素删除。 List list = new ArrayList(); list .add(“a”); for(Iterator it = list .iterator(); iter.hasNext();) { ...
分类:
其他好文 时间:
2016-06-17 06:11:07
阅读次数:
164