python
SoySauce_lm
要想解决纷争,必先陷入纷争。迎接审判吧!
展开
-
Python教程(1)爬虫一分钟入门
Python教程(1)爬虫简介urllib2requests简介Life is short, You need Pythonurllib21.防止网站封ip,可以每次使用ip代理池去进行爬取数据2.添加头信息 user_agent ,模仿浏览器抓取网页3简单示例:requests简单示例: 未完待续...原创 2019-01-17 23:44:41 · 3968 阅读 · 0 评论 -
Thinking in Python: Difference between __str__ and __repr__ in Python
Thinking in Python: Difference between __str__ and __repr__ in Python区别网友的一些回答区别repr 和 str 的区别在于,后者是在 str() 函数被使用,或是在用 print 函数打印一个对象的时候才被调用的,并且它返回的字符串对终端用户更友好。如果你只想实现这两个特殊方法中的一个,repr 是更好的选择,因为如果...原创 2019-01-18 17:49:43 · 2038 阅读 · 0 评论 -
Thinking in Python:What's the difference between %r, %s and %d in python?
Thinking in Python:What's the difference between %r, %s and %d in python?The %s specifier converts the object using str(), and %r converts it using repr().对于某些对象(如整数),它们会产生相同的结果,但是repr()特别之处(对于可能的类型...原创 2019-01-18 18:14:30 · 2132 阅读 · 0 评论 -
Thinking in Python:Decorator
Thinking in Python:Decorator简介demo简介在代码运行期间动态增加功能的方式,称之为“装饰器”(Decorator)。在面向对象(OOP)的设计模式中,decorator被称为装饰模式。OOP的装饰模式需要通过继承和组合来实现,而Python除了能支持OOP的decorator外,直接从语法层次支持decorator。Python的decorator可以用函数实现...原创 2019-01-24 22:00:00 · 287 阅读 · 0 评论 -
Python 日期和时间
Python 日期和时间原创 2019-01-24 22:43:29 · 271 阅读 · 0 评论 -
Python之禅
Python之禅The Zen of Python, by Tim PetersBeautiful is better than ugly.Explicit is better than implicit.Simple is better than complex.Complex is better than complicated.Flat is better than nested...原创 2019-01-22 13:53:09 · 323 阅读 · 0 评论 -
python del和垃圾回收
python del和垃圾回收对象绝不会自行销毁;然而,无法得到对象时,可能会被当作垃圾回收。del 语句删除名称,而不是对象。del 命令可能会导致对象被当作垃圾回收,但是仅当删除的变量保存的是对象的最后一个引用,或者无法得到对象时。 重新绑定也可能会导致对象的引用数量归零,导致对象被销毁。在 CPython 中,垃圾回收使用的主要算法是引用计数。实际上,每个对象都会统计有多少引用...原创 2019-01-30 12:15:41 · 1605 阅读 · 0 评论