infBack changes to portrait how to extract important data from the dictionaries

This commit is contained in:
Eddie 2017-10-23 16:55:37 -05:00
parent 72c4cdd489
commit 824624df3a
1 changed files with 9 additions and 2 deletions

View File

@ -1,11 +1,18 @@
import yaml import yaml
import feedparser as fp
rawDat = open('rss_univ.txt', 'r') rawDat = open('rss_univ.txt', 'r')
strDat = rawDat.read() strDat = rawDat.read()
rawDat = strDat.split(';\n') rawDat = strDat.split(';\n')
index = len(rawDat) - 1
rawDat.pop(index)
# rawDat = yaml.load(rawDat[0]) strDat = yaml.load(rawDat[0])
print(rawDat[0]) # 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'])