Page 85 -
P. 85
change of address
Beans'R'Us is rewarding loyal customers
The CEO just got great news from the beans supplier.
The supplier is so happy
about all the business we‛re giving
them that they are going to make
us members of their loyalty discount
program. They say it should be a
simple fix. Can you look into it?
The supplier actually maintains two prices: one for regular customers
and one for loyalty program customers. The different prices are published on
different web pages:
Regular customers get
their prices here.
http://www.beans-r-us.biz/prices.html
Loyalty program
customers get http://www.beans-r-us.biz/prices-loyalty.html
their prices here.
That means you need to change the web page address in the code:
import urllib.request
page = urllib.request.urlopen("http://www.beans-r-us.biz/prices-loyalty.html")
text = page.read().decode("utf8")
This is the new
price = text[234:238] address.
print(price)
Let’s run it to make sure everything works OK.
50 Chapter 2