Python
MIPS71
这个作者很懒,什么都没留下…
展开
-
Sublime text 白框解决办法
安装Anaconda后,代码输入时有白框。解决办法:Sublime>Perferences>Package Settings>Anaconda>Setting User修改配置 {"anaconda_linting":false}原创 2017-03-21 10:31:00 · 3492 阅读 · 2 评论 -
Python 无穷大无穷小 inf -inf
无穷大:float('inf')无穷小:float('-inf')In [1]:a = float('inf')In [2]: 1 Out[2]:TrueIn [3]: 10000000 > aOut[3]:FalseIn [4]:b = float('-inf')In原创 2018-01-16 20:23:22 · 1523 阅读 · 0 评论 -
Python OpenGL基本配置
参考:http://pyopengl.sourceforge.net一、pip 安装 PyOpenGLpip install PyOpenGL PyOpenGL_accelerate二、测试代码from OpenGL.GL import *from OpenGL.GLU import *from OpenGL.GLUT import *def原创 2018-01-16 14:20:33 · 5312 阅读 · 0 评论 -
Python 简单单继多继承尝试
单继承class Point(): def __init__(self, x, y): self.x = x self.y = y print('Point constructor') def ToString(self): return "{{X: {},Y: {}}}".format(self.x, sel原创 2018-01-13 22:39:51 · 260 阅读 · 0 评论 -
Python random, pickle
1.randomimport random1.1 randinthelp(random.randint)Help on method randint in module random:randint(a, b) method of random.Random instance Return random integer in range [a, b], in原创 2018-01-13 17:43:32 · 232 阅读 · 0 评论 -
Python abs, bool, dir, eval, exec
Python abs, bool, dir, eval, exec原创 2018-01-13 16:48:57 · 226 阅读 · 0 评论 -
Python 浅拷贝 深拷贝
看《流畅的Python》8.3节默认做浅拷贝,自己动手实践。书中提到的网站http://pythontutor.com是一个可视化编程的网站。csdn不支持图片粘贴,我也是服了,图片全没了。。。一、浅拷贝在http://pythontutor.com/visualize.html#mode=edit下输入:import copyl1 = [3, [66,55,44],原创 2018-01-13 16:19:16 · 262 阅读 · 0 评论 -
Python range 逆序迭代
python range逆序迭代使用python3.0,range是一个可迭代对象1. 正序range(6):0,1,2,3,4,52.逆序range(5, -1, -1):5,4,3,2,1,03.用切片逆序:range(6)[::-1]5,4,3,2,1,04.reversed():reversed(range(6))原创 2017-12-04 18:38:50 · 24816 阅读 · 1 评论 -
Python OpenCV 简单图像比较
项目需要做两张图像比较的差,感觉Python用起来很方便,手头正好有OpenCV。红绿代表插值正负,为了更好的可视化,差值均放大10倍显示。import cv2def clmap(v, k, upBound): #mul and clamp val = v * k if val > upBound: return upBound else:原创 2015-01-15 16:41:36 · 4220 阅读 · 2 评论 -
Python中defaultdict方法的使用
参见:http://blog.csdn.net/real_ray/article/details/17919289我补充一点from collections import defaultdictdefaultdict可以和lambda一起使用:In [21]: d = defaultdict(lambda : 100)In [22]: d[0]Out[22]: 100In [23]: d转载 2018-01-17 22:58:47 · 418 阅读 · 0 评论