
prthon
诸葛苍穹
...
展开
-
python基础抓取网页
#encoding UTF-8import urllib.request#设置urlurl = 'http://www.taobao.com'data = urllib.request.urlopen(url).read()data.decode('UTF-8')print(data)原创 2017-03-24 21:19:46 · 472 阅读 · 0 评论 -
python 装饰器
""" codecs -- Python Codec Registry, API and helpers.Written by Marc-Andre Lemburg (mal@lemburg.com).(c) Copyright CNRI, All Rights Reserved. NO WARRANTY."""import builtinsimport sys### Re..原创 2018-07-26 23:55:43 · 220 阅读 · 0 评论 -
__call__ && __setitem__ && __getitem__ && __delitem__&&__new__的用法
在类中设置对象获取对象删除对象相当于字典操作class Foo: def __init__(self): self.__data = {} def talk(self): print("test") def __call__(self, *args, **kwargs): print("running",args,kwar...原创 2018-09-04 23:51:07 · 216 阅读 · 0 评论