python
hello,️
这个作者很懒,什么都没留下…
展开
-
py4e-ch8-list-ex08_05
// A code blockvar foo = 'bar';// An highlighted block'''8.4 Open the file romeo.txt and read it line by line. For each line,split the line into a list of words using the split() method.The pro...原创 2019-04-03 23:34:24 · 552 阅读 · 0 评论 -
什么是API?
编者按:何为API?如果你在百度百科上搜索,你会得到如下结果:API(Application Programming Interface,应用程序编程接口)是一些预先定义的函数,目的是提供应用程序与开发人员基于某软件或硬件得以访问一组例程的能力,而又无需访问源码,或理解内部工作机制的细节。那么再通俗一点来说,API究竟是什么呢?在我学习软件开发之前,API听起来似乎像是一种啤酒。而现在,我开始...转载 2019-05-02 17:59:25 · 1408 阅读 · 0 评论 -
什么是REST?
What 什么是REST表述性状态转移。一种web 服务的架构风格Who 谁发明的RESTroy fielding 于2000年写的论文核心资源统一接口状态转移REST成熟度模型http表示抽象的资源用http动词来表述对资源的增删改查REST的问题如何聚合多个接口返回的内容浏览api如何能像浏览网页那样资源表述用名词来表述资源,用http方法来表述CRUDurl...转载 2019-05-02 17:57:27 · 165 阅读 · 0 评论 -
Coursera-python-第十一章-正则表达式-习题-ex_11_01
题目:将文件中的数字都提取出,并对数字进行求和。// An highlighted blockimport re #导入正则表达式的包name = input("Enter File name:")file = open(name) #打开文件y = [] #初始化一个列表accumulation = 0 #初始化一个i...原创 2019-04-18 15:27:59 · 151 阅读 · 0 评论 -
ex_13_01.py
// An highlighted blockimport urllib.request, urllib.parse, urllib.errorimport xml.etree.ElementTree as ETimport sslimport requeststxt = requests.get(url="http://py4e-data.dr-chuck.net/comments_...原创 2019-05-01 18:23:31 · 188 阅读 · 0 评论 -
ex_10_02
题目:提取文本中以From开头的行,并计算某一数值出现的次数。// An highlighted blockname = input("Enter file:")if len(name) < 1 : name = "mbox-short.txt"handle = open(name)count = dict() #初始化一个字符串count_small = dict()...原创 2019-04-05 14:50:10 · 141 阅读 · 0 评论 -
COURSEA-PYTHON-ex_07_02
题目:‘’’Write a program that prompts for a file name,then opens that file and reads through the file,looking for lines of the form:X-DSPAM-Confidence: 0.8475Count these lines and extract the fl...原创 2019-03-31 15:35:06 · 348 阅读 · 0 评论 -
Coursea-py4e-ex_09_04中的代码解析-字典-dictionary
// An highlighted block'''9.4 Write a program to read through the mbox-short.txt andfigure out who has sent the greatest number of mail messages.The program looks for 'From ' lines andtakes the s...原创 2019-04-04 20:20:38 · 349 阅读 · 0 评论 -
COURSEA-PYTHON-ex_07_01
题目:7.1 Write a program that prompts for a file name,then opens that file and reads through the file,and print the contents of the file in upper case.Use the file words.txt to produce the output be...原创 2019-03-31 14:53:33 · 484 阅读 · 0 评论 -
ex_08_05错误:list index out of range
// An highlighted block'''Open the file mbox-short.txt and read it line by line.When you find a line that starts with 'From ' like the following line:From stephen.marquard@uct.ac.za Sat Jan 5 09:...原创 2019-04-03 23:47:37 · 263 阅读 · 0 评论 -
获取网页上的文件、页面等的文件类型,文件内容,所在服务器最后修改时间
固定代码,将文件所在的URL输入即可// An highlighted blockimport socketmysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)mysock.connect(('data.pr4e.org', 80))cmd = 'GET https://www.baidu.com/ HTTP/1.0\r\...原创 2019-04-18 22:32:54 · 682 阅读 · 0 评论