def whetherCoauthor(url, name): pub= rest.download(url) cnt= 0 ## Use Regular expr- concept, cnt+= pub.count(name) return
def load(url): data = memcache.get(url) if data is not None: return data data = rest.download(url) if data: memcache.set(url, data, 3600) return data
def reportPubsYrs(url,odic): pub= rest.download(url) yrs= ['2005','2006','2007','2008','2009','2010','2011'] dic= {} for y in yrs: dic[y]= max(int(pub.count(y)), odic[y] ) return dic