2017-10-23 18:37:14 +00:00
|
|
|
import yaml
|
2017-10-23 21:55:37 +00:00
|
|
|
import feedparser as fp
|
2017-10-23 18:37:14 +00:00
|
|
|
|
|
|
|
rawDat = open('rss_univ.txt', 'r')
|
|
|
|
|
|
|
|
strDat = rawDat.read()
|
|
|
|
|
|
|
|
rawDat = strDat.split(';\n')
|
2017-10-23 21:55:37 +00:00
|
|
|
index = len(rawDat) - 1
|
|
|
|
rawDat.pop(index)
|
2017-10-23 18:37:14 +00:00
|
|
|
|
2017-10-23 21:55:37 +00:00
|
|
|
strDat = yaml.load(rawDat[0])
|
2017-10-23 18:37:14 +00:00
|
|
|
|
2017-10-23 21:55:37 +00:00
|
|
|
# this section of the code show how to extract relevant data from the dictionaries
|
|
|
|
print(len(rawDat))
|
|
|
|
print(strDat['entries'][0]['title'])
|
|
|
|
print(strDat['entries'][0]['links'][0]['href'])
|
|
|
|
print(strDat['entries'][0]['summary'])
|