Why is my code printing 'None'?
My code can be found here:
https://github.com/thekarangoel/HackerNewsAPI/blob/master/hn.py
The test case is this:
from hn import HN
hn = HN()
for story in hn.get_top_stories()[:10]:
print story.print_story()
print '*' * 50
print ''
This prints my output like so:
.....
.....
.....
**************************************************
Rank: 3
Story ID: 6231993
Title: Pipe Dream? 3D-Printed Model of Hyperloop Created
Link:
http://news.yahoo.com/pipe-dream-3d-printed-model-hyperloop-created-192033757.html
Domain: yahoo.com
Points: 1
Submitted by: evo_9
Number of comments: 0
Link to comments: http://news.ycombinator.com/item?id=6231993
None
**************************************************
Rank: 4
Story ID: 6231992
Title: What colour are your bits?
Link: http://ansuz.sooke.bc.ca/entry/23
Domain: bc.ca
Points: 1
Submitted by: grey-area
Number of comments: 0
Link to comments: http://news.ycombinator.com/item?id=6231992
None
.....
.....
Notice the None at the end of each print? Why is it there? What's wrong
with the code?
No comments:
Post a Comment