![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
文章平均质量分 87
AlvaroJoe
垃圾小硕一枚,兼顾图像处理和软件开发
展开
-
Python中的with...as语句
最近出差有点自己的空闲时间,于是这些日子又把Python的学习捡起来了。之前大四做毕设和大创的时候用过一点Python2,也不知道再捡起来是否顺利。 前两天在看一个用urllib库写爬虫的Demo的时候,看到了下面这一段代码: with request.urlopen(oriurl) as response: for line in response: line = line.decode("utf-8") # Decoding the binary data to text原创 2021-08-10 22:04:36 · 339 阅读 · 0 评论 -
Python中实现多属性排序
我们有一组记录: list_records = [ (department, name, salary), (department, name, salary), '''...''' (department, name, salary) ] 然后我们想进行类似 MS – Excel 里的 “then sort by” 中的功能一样先基于department排序,然后再在部门内按照转载 2013-05-02 13:21:43 · 1499 阅读 · 0 评论