Download presentation
Presentation is loading. Please wait.
1
Python – May 20 Reading data from the Web
Example: web.py Practice with large amount of I/O See lab sheet
2
Web input Just like Java, Python has an easy way to automatically read a Web page import urllib2 page = urllib2.urlopen(“ Can continue as if “page” is an input file for line in page: Example: web.py reads a stock quote.
3
Large input Algorithm needs to be practical, in addition to correct. Beware of nested loops Comments about the data; “density” #3 - County population, area, density Assume that all blocks in county are listed together. #5 – Creating tract-level data Need to look up tract in dictionary search for tract, because blocks in input file are not sorted by tract Once you are finished with a county, you can output all its tracts and empty the dictionary.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.