diff options
author | sstvinc2 <sstvinc2@gmail.com> | 2017-02-19 10:56:13 -0600 |
---|---|---|
committer | sstvinc2 <sstvinc2@gmail.com> | 2017-02-19 10:56:13 -0600 |
commit | 53de97fd3c6fdb4c95a89171b52064a05b157fbf (patch) | |
tree | a6bd0a49ee1b11cb0c4b5d9333507411b44071b8 /unbiasedFunctions.py | |
parent | d1c7dfc9c2a47edf80527c2457481b9508087ce6 (diff) |
Print output formatting
Diffstat (limited to 'unbiasedFunctions.py')
-rw-r--r-- | unbiasedFunctions.py | 18 |
1 files changed, 12 insertions, 6 deletions
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)):
|