Finishing Regular Expressions XML / Web Scraping

[Pages:40]Finishing Regular Expressions &

XML / Web Scraping

Nov 10 2015

CSCI 0931 - Intro. to Comp. for the Humanities and Social Sciences

1

Today

? Iterators ? Do ACT 3-2 ? Finish Regular Expressions ? XML Parsing in Python

CSCI 0931 - Intro. to Comp. for the Humanities and Social Sciences

2

Data Structures

Lists content `a' `b' `c' `d' `e' `f' `g' `h' `i' `j'

indices 0 1 2 3 4 5 6 7 8 9

Dictionaries

keys & values

`Alice' -> `401-111-1111' `Carol' -> `401-333-3333'

`Bob' -> `401-222-2222'

Iterators

Match Objects

Match 1

Match 2

Match 3

? Matched String Match ? Matched String Start

4 ? Matched String End

CSCI 0931 - Intro. to Comp. for the Humanities and Social Sciences

3

Iterators

The cat in the hat sat on a mat

Regular Expression:`\wat'

CSCI 0931 - Intro. to Comp. for the Humanities and Social Sciences

4

Iterators

The cat in the hat sat on a mat

Regular Expression:`\wat'

Iterator

Match 1

CSCI 0931 - Intro. to Comp. for the Humanities and Social Sciences

5

Iterators

The cat in the hat sat on a mat

Regular Expression:`\wat'

Iterator

Match 1

Match 2

CSCI 0931 - Intro. to Comp. for the Humanities and Social Sciences

6

Iterators

The cat in the hat sat on a mat

Regular Expression:`\wat'

Iterator

Match 1

Match 2

Match 3

CSCI 0931 - Intro. to Comp. for the Humanities and Social Sciences

7

Iterators

The cat in the hat sat on a mat

Regular Expression:`\wat'

Iterator

Match 1

Match 2

Match 3

Match 4

CSCI 0931 - Intro. to Comp. for the Humanities and Social Sciences

8

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download