def get_latest_twic(): filename = download_file("http://www.theweekinchess.com/twic") latest = None if filename is None: return latest PREFIX = 'href="http://www.theweekinchess.com/html/twic' with open(filename) as f: for line in f: if line.lstrip().startswith(PREFIX): latest = int(line.strip()[len(PREFIX):-6]) break return latest
def get_latest_twic(): filename = download_file("http://www.theweekinchess.com/twic") latest = None if filename is None: return latest PREFIX = 'href="http://www.theweekinchess.com/html/twic' with open(filename) as f: for line in f: position = line.find(PREFIX) if position >= 0: latest = int(line[position + len(PREFIX):][:4]) break return latest
def get_latest_twic(): filename = download_file("http://www.theweekinchess.com/twic") latest = None if filename is None: return latest PREFIX = 'href="http://www.theweekinchess.com/html/twic' with open(filename) as f: for line in f: position = line.find(PREFIX) if position >= 0: latest = int(line[position + len(PREFIX):][:4]) break return latest