head first series 学习记录(Python)
来源:互联网 发布:linux不保存退出vi 编辑:程序博客网 时间:2024/06/04 19:40
1.缩进很重要
2.输入的时候需要加上引号
3.page 40
这样写不对。
import urllib2
page=urllib2.urlopen("http://www.beans-r-us.biz/prices.html")
text=page.read().decode("utf8")
print(text)
这样还是不对。
import urllib2
page=urllib2.urlopen('http://www.beans-r-us.biz/prices-loyalty.html')
text=page.read().decode('big5').encode('utf8') //text=page.read().encode('utf8')
price=text[234:238]
print(price)
把网址换成可以正常访问的就okay。
4.page 57讲了一些方法。
5.twitter那个例子没有看。 ~page 1026
6.后面也没有看。 ~111
7.大概在page 153的这一段
scores={}
scores[8.45]='Joseph'
scores[9.12]='Juan'
scores[7.21]='Zack'
for key in scores.keys():
print(scores[key]+' had a score of '+str(name_part))
for score, suffer in scores.items():
print(suffer+' had a score of '+str(score))
运行不成功,我也不明白那个 name_part是什么意思。
注:
urllibPython 2 namePython 3 name
urllib.urlopen() Deprecated. See urllib.request.urlopen() which mirrorsurllib2.urlopen()
urllib.urlretrieve() urllib.request.urlretrieve()
urllib.urlcleanup() urllib.request.urlcleanup()
urllib.quote() urllib.parse.quote()
urllib.quote_plus() urllib.parse.quote_plus()
urllib.unquote() urllib.parse.unquote()
urllib.unquote_plus() urllib.parse.unquote_plus()
urllib.urlencode() urllib.parse.urlencode()
urllib.pathname2url() urllib.request.pathname2url()
urllib.url2pathname() urllib.request.url2pathname()
urllib.getproxies() urllib.request.getproxies()
urllib.URLopener urllib.request.URLopener
urllib.FancyURLopener urllib.request.FancyURLopener
urllib.ContentTooShortError urllib.error.ContentTooShortError
今天晚上看到page200,明天 come on!
- head first series 学习记录(Python)
- head first series 读书记录
- head first python 读书记录
- 《Head First Python》学习笔记
- Head First Python学习总结
- Head First Python学习笔记
- Head First Python第三章知识点记录
- 《Head First 设计模式学习记录-终篇亦非终篇》
- 《Head First 设计模式学习记录-终篇亦非终篇》
- Python学习笔记《Head first for Python》
- 《Head First Python》学习笔记 01
- head first python chap 5 学习笔记
- Head First Python 学习笔记-Chapter5:数据处理
- Head First Python学习笔记(1)
- Head First Python学习笔记(2)
- Head First Python 第三章 学习笔记
- Head First Python
- Head First Python 读书笔记
- HDU-动能定理-人的降落
- FFmpeg 获取h264裸码流
- 堆对象的new与delete
- 软交所助力国家级软件评测中心
- 单文件上传
- head first series 学习记录(Python)
- java枚举类型enum的使用
- jquery-easyui 后台加载数据的问题
- WPF语法高亮控件AvalonEdit
- 当一种信奉根深柢固的时分,慢慢地表面也会发生改变
- 代理模式
- tomcat启动的时候,没加载xml配置文件
- float 与double 的区别
- ios中frame与bounds区别