1.get
请求参数在url里可以看到,最多1024字节。
2.post
看不到,数据通过表单输送,数据在请求体里。
3.css选择器
.intro 选择class=intro的所有节点 #firstname 选择id=firstname *选所以
4.urllib
request error parse robotparser
5.yield
yield对应的值会被返回出来。包含yield的函数是生成器,生成器每次产生一个值后被冻结,唤醒后在产生一个值。节省存储空间,,,,for i in gen(5) 与 for i in (1,4,9,16)
6.python中response.read()不能换行的问题
>>> import urllib.parse
>>> import urllib.request
>>> data=bytes(urllib.parse.urlencode({'word':'hello'}),encoding='utf-8')
>>> response=urllib.request.urlopen('http://httpbin.org/post',data=data)
>>> print(response.read())
b'{\n "args": {}, \n "data": "", \n "files": {}, \n "form": {\n "word": "hello"\n }, \n "headers": {\n "Accept-Encoding": "identity", \n "Content-Length": "10", \n "Content-Type": "application/x-www-form-urlencoded", \n "Host": "httpbin.org", \n "User-Agent": "Python-urllib/3.7"\n }, \n "json": null, \n "origin": "139.170.2.252, 139.170.2.252", \n "url": "https://httpbin.org/post"\n}\n'
>>>
应该是print相关的问题,里面的参数添加不合理
print(response.read())改为print(response.read().decode('utf-8'))即可
---------------------
作者:dancria
来源:CSDN
原文:https://blog.csdn.net/dancria/article/details/88559395
版权声明:本文为博主原创文章,转载请附上博文链接!
7.'seq' is an invalid keyword argument for print()
print 有没有seq???
8.http://www.baidu.com/index.html:user?id=5#comment
scheme://netloc/path;params?query #fragment
协议 ://域名 /路径;参数 ?查询条件#锚点