def population_check(filename): with open(filename, 'r') as f: for page in wp.wikipedia_to_single_line_pages(f): population = wp.find_property(page, 'population_total') population = int( wp.extract_numeric( population.replace(',', '').replace(' ', ''))) print >> sys.stderr, "population:", population
def test_find_property(): wikipedia_exerpt = """ | country leader name = | population = 31,572 | population as of = Jan 1, 2009 """ text = "".join(wikipedia_exerpt.split('\n')) print >>sys.stderr, "text:", text population = wp.find_property(text, 'population') print >>sys.stderr, "population:", population
def test_find_property(): wikipedia_exerpt = """ | country leader name = | population = 31,572 | population as of = Jan 1, 2009 """ text = "".join(wikipedia_exerpt.split('\n')) print >> sys.stderr, "text:", text population = wp.find_property(text, 'population') print >> sys.stderr, "population:", population
def population_check(filename): with open(filename, 'r') as f: for page in wp.wikipedia_to_single_line_pages(f): population = wp.find_property(page, 'population_total') population = int(wp.extract_numeric(population.replace(',', '').replace(' ',''))) print >>sys.stderr, "population:", population