Menu

[Solved] Exercise Regarding Simple Python Aggregator Listreaderpy Import Re Class Listreader Reads Q37280166

This is an exercise regarding a simple Pythonaggregator.

list_reader.py

import re

class ListReader:
“”” Reads URIs from file “””

def get_uris(self, filename):
“”” Returns a list of the URIs contained in the named file“””
file = open(filename, ‘r’)
text = file.read()
file.close()

# get the first block of a Netscape file

text = text.split(‘</DL>’)[0]

# get the uris
pattern = ‘http://S*w’
return re.findall(pattern,text)

Extend the range of the elements above, by addingsupport for dc: source. Your first challenge is to extend theapplication so that it also displays the author of a feed entry, ifthat information is available.

Expert Answer


Answer to This is an exercise regarding a simple Python aggregator. list_reader.py import re class ListReader: “”” Reads URI… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *