Code is now a funtion

This commit is contained in:
Eddie 2017-10-30 10:20:44 -06:00
parent bbd35358e4
commit 85626bd795
1 changed files with 20 additions and 14 deletions

View File

@ -1,26 +1,32 @@
import yaml def get_vect():
rawDat = open('rss_univ.txt', 'r') import yaml
strDat = rawDat.read() rawDat = open('rss_univ.txt', 'r')
rawDat = strDat.split(';\n') strDat = rawDat.read()
index = len(rawDat) - 1 rawDat = strDat.split(';\n')
rawDat.pop(index)
strDat = [] index = len(rawDat) - 1
rawDat.pop(index)
for i in rawDat: strDat = []
strDat.append(yaml.load(i))
del rawDat for i in rawDat:
strDat.append(yaml.load(i))
del rawDat
impDat = []
for d in strDat:
impDat.append([d['entries'][0]['title'], d['entries'][0]['links'][0]['href'], d['entries'][0]['summary']])
del strDat
return impDat
impDat = []
for d in strDat:
impDat.append([d['entries'][0]['title'], d['entries'][0]['links'][0]['href'], d['entries'][0]['summary']])
del strDat
# this section of the code show how to extract relevant data from the dictionaries # this section of the code show how to extract relevant data from the dictionaries
""" """