It's Perror
流畅的python--dict的优点以及缺点 流畅的python--dict的优点以及缺点
以下是Python中字典的一些特点: 健必须是可散列的。这意味着键必须支持hash()函数,并且通过hash()方法得到的散列值是不变的。此外,它们还必须支持eq()方法以检测相等性。如果a == b,则hash(a) == hash(b
2017-06-17 Perror
Hash tables in Python dictionaries Hash tables in Python dictionaries
Dictionaries in Python use hash tables, which are actually sparse arrays, meaning that some elements are empty. When con
2017-06-15 Perror
流畅的python--特殊方法 流畅的python--特殊方法
Python中的特殊方法主要是被Python解释器调用,大部分情况下不需要自己实现特殊方法,比如len(x),实际上是调用了len()方法。在实际编程中,我们不会使用x.len()这样的写法。如果x是一个自己实现的类并且在类里面实现了一个l
2017-06-15 Perror
python根据exif信息旋转图片 python根据exif信息旋转图片
最近写业务代码时遇到了一个需求:压缩图片。这本应该是一个简单的需求,三下五除二就能解决。但是当我用手机上传图片时,发现压缩后的图片都歪了。经过查找,发现问题出在图片的exif信息中的Orientation记录,它记录了图片的旋转角度。因此,
2017-06-08 Perror
Advanced Usage of Python -- namedtuple Advanced Usage of Python -- namedtuple
The namedtuple function can be used to create a named tuple or class, which can be more effective for debugging code. He
2017-06-07 Perror
2 / 2