Make sure you understand what is going on here:
import urllib2
import datetime
from bs4 import BeautifulSoup as soup
url = "http://app2.nea.gov.sg/anti-pollution-radiation-protection/air-pollution/psi/psi-readings-over-the-last-24-hours"
web_soup = soup(urllib2.urlopen(url))
table = web_soup.find(name="div", attrs={'class': 'c1'}).find_all(name="div")[2].find_all('table')[0]
data = {}
bold_time = ''
cur_time = datetime.datetime.strptime("12AM", "%I%p")
for tr_index, tr in enumerate(table.find_all('tr')):
if 'Time' in tr.text:
continue
for td_index, td in enumerate(tr.find_all('td')):
if not td_index:
continue
data[cur_time] = td.text.strip()
if td.find('strong'):
bold_time = cur_time
cur_time += datetime.timedelta(hours=1)
print data.get(bold_time) # bold
print data.get(bold_time - datetime.timedelta(hours=1)) # before bold
print data.get(bold_time - datetime.timedelta(hours=2)) # before before bold
This will print the 3-hr PSI
value that is marked in bold and two values before it (if exist).
Hope that helps.