Python Web-第五周-Web Services and XML(Using Python to Access Web Data)
1.Web Service Overview
1.Data on the Web

Python Dictionary 和 Java HashMap间需要建立一个桥梁,可以用XML或是JSON
2.XML

3.JSON: JavaScript Object Notation

2.Interview:Roy Fielding - Understanding the REST Architecture
1.知乎上lvony关于REST结构的概括

3.eXtensible MarkUp Language - XML
1.XML 的诞生

XML诞生的目的就是帮助各个信息系统间交换指定结构的数据
docx、pptx 中的x都代表XML,XML用于描述其文档结构
2.XML元素

3.XML举列

XML的各种属性不同于HTML,是可以根据需要自行设置的

XML基本就是个树结构,像是文件夹目录/a/b/、/a/c/d
4.XML Schema
1.XML Schema定义
2.XML Schema作用
5.Parsing XML in Python
1.XML实例
import xml.etree.ElementTreeas ET
data ='''
<person>
<name>Chuck</name>
<phone type="intl">
+1 734 303 4456
</phone>
<email hide="yes"/>
</person>'''
tree = ET.fromstring(data)
print'Phone:',tree.find('phone').text
print'Phone Type:',tree.find('phone').get('type')
print'Attr:',tree.find('email').get('hide')
import xml.etree.ElementTreeas ET
input ='''
<stuff>
<users>
<user x="2">
<id>001</id>
<name>Chuck</name>
</user>
<user x="7">
<id>009</id>
<name>Brent</name>
</user>
</users>
</stuff>'''
stuff = ET.fromstring(input)
lst = stuff.findall('users/user')#return a list
print'User count:', len(lst)
for item in lst:
print'Name', item.find('name').text
print'Id', item.find('id').text
print'Attribute', item.get("x")
Words:
Python Web-第五周-Web Services and XML(Using Python to Access Web Data)的更多相关文章
- 初学 Python(十五)——装饰器
初学 Python(十五)--装饰器 初学 Python,主要整理一些学习到的知识点,这次是生成器. #-*- coding:utf-8 -*- import functools def curren ...
- 《Using Python to Access Web Data》 Week5 Web Services and XML 课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week5 Web Services and XML 13.1 Data on the ...
- The Python web services developer: XML-RPC for Python
原文地址:http://www.ibm.com/developerworks/webservices/library/ws-pyth10/index.html 摘要:概括地说,您可以将 XML-RPC ...
- Python Web-第二周-正则表达式(Using Python to Access Web Data)
0.课程地址与说明 1.课程地址:https://www.coursera.org/learn/python-network-data/home/welcome 2.课程全名:Using Python ...
- java web 学习五(servlet开发1)
一.Servlet简介 Servlet是sun公司提供的一门用于开发动态web资源的技术. Sun公司在其API中提供了一个servlet接口,用户若想用发一个动态web资源(即开发一个Java程序向 ...
- 五张图概括 什么是 ASP 、 ASP.NET (Web Pages,Web Forms ,MVC )
当你看懂下面这五张图,我相信你对于学习.NET Web开发路线将不陌生! 来源: http://www.w3 ...
- 【Python学习笔记】Coursera课程《Using Python to Access Web Data》 密歇根大学 Charles Severance——Week6 JSON and the REST Architecture课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week6 JSON and the REST Architecture 13.5 Ja ...
- 【Python学习笔记】Coursera课程《Using Python to Access Web Data 》 密歇根大学 Charles Severance——Week2 Regular Expressions课堂笔记
Coursera课程<Using Python to Access Web Data > 密歇根大学 Charles Severance Week2 Regular Expressions ...
- 《Using Python to Access Web Data》Week4 Programs that Surf the Web 课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week4 Programs that Surf the Web 12.3 Unicod ...
随机推荐
- ThinkPHP的基本操作
一.生成入口文件 1.打开服务器,在本地环境测试时在地址栏输入localhost/项目文件名/index.php 可以在Application下面生成一个home模块,记得在这之前,要建立一个项目文 ...
- Shiro 核心功能案例讲解 基于SpringBoot 有源码
Shiro 核心功能案例讲解 基于SpringBoot 有源码 从实战中学习Shiro的用法.本章使用SpringBoot快速搭建项目.整合SiteMesh框架布局页面.整合Shiro框架实现用身份认 ...
- 在项目中遇到关于 CSS Overflow Hidden在iPhone & Safari不起作用
调试了半天 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <m ...
- sphinx初识
sphinx(SQL Phrase Index),查询词组索引. 定义:Sphinx是一个全文检索引擎. 特性: 1.高速索引 (在新款CPU上,近10 MB/秒); 2.高速搜索 (2-4G的文本量 ...
- Swagger2 Oauth2.0 令牌 请求头
@EnableSwagger2 @Bean public Docket createRestApi() { ParameterBuilder tokenPar = new ParameterBuild ...
- APP性能测试(CPU)
获取数据 :adb shell dumpsys cpuinfo | grep packagename result = os.popen("adb shell dumpsys cpuinfo ...
- easywechat之微信支付--在thinkPHP5中的使用
1. 准备工作 1.1 easywechat 安装完成 未安装移步至 -> http://www.cnblogs.com/flyphper/p/8484600.html 1.2 确定支付相关的配 ...
- Redis笔记3-redis事务
Redis的事务机制允许同时执行多条指令,它是原子性操作,事务中的命令要么全部执行,要么全部不执行,另外,事务中的所有指令都会被序列化,而且其开始执行过程中,不回被即时过来的指令所打断,其需要经历三个 ...
- Hadoop 错误归档库
在hive中操作任意mapreduce相关语句 The size of Container logs revealed the below error: 2015-04-24 11:41:41,858 ...
- Linux内核开发之将驱动程序添加到内核
驱动程序添加到内核 一.概述: 在Linux内核中增加程序需要完成以下三项工作: 1.将编写的源代码复制到Linux内核源代码的相应目录 2.在目录的Kconfig文件中增加新源代码对应项目的编译配置 ...
