Class 14 — Friday February 14

Web chrestomathics

How was I to know — Person sitting next to me — Would become my spouse


Look both ways


Agenda


Notices


For the fun of it


To do list


Downloads


CS 1112 CSV datasets


Web programming

import urllib.request

stream = urllib.request.urlopen( link )

page = stream.read()

text = page.decode()

The above assignment sets text to be the decoded contents of the url resource named by link; that is text is a string equaling the contents of the url resource indicted by link.

import urllib.request # get module access

stream = urllib.request.urlopen( link ) # open connector to the link web resource

page = stream.read() # read contents of the resource

text = page.decode() # decode contents as normal text string


Program master_plan.py

???


Program secret_revealed.py

Some program runs

Enter computing id: mst3k

Boo-boo finding

Enter computing id: jpc

Thanato-etos cognition



Program paging_page.py

Some program runs

Enter url: http://www.cs.virginia.edu/~cs1112/words/most-misspelled

appreciate

beautiful

cancelled

definitely

desert

diarrhea

gray

leprechaun

maintenance

neighbor

pneumonia

vacuum

Enter url: http://www.cs.virginia.edu/~cs1112/words/hangman

abated

abhors

ablush

abrade

...

zenith

zephyr

zipper

zombie

Enter url: http://www.cs.virginia.edu/~cs1112/syllabus

<!DOCTYPE html> <html lang="en"> <head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>CS 1112: Spring 2020</title>

<link rel="shortcut icon" href="/~cs1112/images/favicon.ico" /><link rel="stylesheet" type="text/css" href="/~cs1112/defs/css/201-default.css"></head>

<body class="single-column-page">

<div class="task-bar">

<br/>

<table class="header-bar">

<tr style="line-height: 26px;">

  <td style="text-align: center; vertical-align: middle">

  <a class="menu" href="/~cs1112/term/201/">

  <img style="height: 35px" src="/~cs1112/images/home.svg" alt="home icon">

  </a> </td>

  <td style="text-align: center; vertical-align: middle;"> <a class="menu" href="/~cs1112/software/" > <img style="height: 35px" src="/~cs1112/images/computer.svg" alt="software icon"> </a> </td>

...

<li>This syllabus is to be considered a reference document that can and will be adjusted through the course of the semester to address changing needs. It is up to the student to monitor this page for any changes. Final authority on any decision in this course rests with the professor, not with this document.</li>

</ul>

<br/>  

<br/>  

<br/>  

<br/>  

<br/>  

<br/>  

<br/>  

<br/>  

</div>

</body>

</html>



Program get_a_dataset.py

Some program runs

Enter name of dataset: best-sellers.csv

['Name', 'Author', 'Language', 'Date', 'Sales']

['Don Quixote', 'de Cervantes', 'Spanish', '1605', '500000000']

['A Tale of Two Cities', 'Dickens', 'English', '1859', '200000000']

['The Lord of the Rings', 'Tolkien', 'English', '1954', '150000000']

['The Little Prince', 'de Saint-Exupery', 'French', '1943', '140000000']

["Harry Potter and the Philosopher's Stone", 'Rowling', 'English', '1997', '120000000']

['The Hobbit', 'Tolkien', 'English', '2017', '100000000']

['And Then There Were None', 'Christie', 'English', '2019', '100000000']

['Dream of the Red Chamber', 'Xueqin', 'Chinese', '1754', '100000000']

["Alice's Adventures in Wonderland", 'Carroll', 'English', '1865', '100000000']

Enter name of dataset: rows_of_stuff.csv

['Asta', 'Hachiko', 'Laika', 'Lassie']

['59.0', 'TruE']

['faLse', '3.14', '271']

['01', '10', '10.0', 'ABC']

['Asta', 'Hachiko', 'Laika', 'Lassie']

[59.0, True]

[False, 3.14, 271]

[1, 10, 10.0, 'ABC']




remember to love


remember to love

 


 
  © 2020 Jim Cohoon   Resources from previous semesters are available.