From 53de97fd3c6fdb4c95a89171b52064a05b157fbf Mon Sep 17 00:00:00 2001 From: sstvinc2 Date: Sun, 19 Feb 2017 10:56:13 -0600 Subject: Print output formatting --- unbiasedFunctions.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'unbiasedFunctions.py') diff --git a/unbiasedFunctions.py b/unbiasedFunctions.py index cab7681..444428f 100644 --- a/unbiasedFunctions.py +++ b/unbiasedFunctions.py @@ -106,7 +106,11 @@ def buildArticle(url, sourceName):#, titleDelStart, titleDelEnd, imgDelStart, im return a except: - print("Article parsing error in buildArticle() for URL: "+url+" in source "+sourceName+'\n') + print('^^^^^^^^^^^^^^^^^^^^^^^^^') + print('\tARTICLE PARSING ERROR') + print('SOURCE: '+sourceName) + print('URL: \t'+url) + print('^^^^^^^^^^^^^^^^^^^^^^^^^ \n\n') return None @@ -131,11 +135,13 @@ def buildOutput(newsSourceArr): while len(h3RandomPairs) < 12: x=random.sample(range(len(newsSourceArr)), 1)[0] print(newsSourceArr[x].name) - y=random.sample(range(len(newsSourceArr[x].h3Arr)), 1)[0] - pair=[x,y] - if not pair in h3RandomPairs: - h3RandomPairs.append(pair) - + if len(newsSourceArr[x].h3Arr) > 0: + y=random.sample(range(len(newsSourceArr[x].h3Arr)), 1)[0] + pair=[x,y] + if not pair in h3RandomPairs: + h3RandomPairs.append(pair) + else: + continue #replace html template locations with data from newsSourceArr for i in range(len(h1RandomSources)): -- cgit v1.2.3