I'm trying to aggregate pieces from different websites and consolidate them into a single site.
Since the information will change daily, I was trying to output the HTML code dynamically with %s formatting. However, this seems ripe for disaster somewhere along the way as the amount of information grows since I don't know of any way I can label the %s to at least keep track of what they're referring to (This is only a fraction of what I would like to ultimately have).
I tried looking at Bootstrap, but it was a little beyond me honestly as all I'm looking to do is have a simple HTML output. Is that the best solution at this point?
url = 'http://rss.nytimes.com/services/xml/rss/nyt/Business.xml'
resp = requests.get(url)
soup = BeautifulSoup(resp.content, features = 'xml')
items = soup.findAll('item')
print(items)
all_items = ''
wrapper = """
Daily Monitor
URL: %s
%s
"""
x = wrapper % ('What', 'to', 'do')
#This is the data I would like to eventually incorporate into the HTML - not used here in the example
for item in items[:10]:
all_items += item.title.text
print(item.description.text)
print(item.link)
#this is how I'm writing out the HTML
filename = 'C:\\test' + '.html'
f = open(filename,'w')
f.write(x)
f.close()