Skip to content

Commit a5089ca

Browse files
Merge pull request geekcomputers#425 from devtycoon/patch-1
Update Google_News.py
2 parents b18c4f8 + 209bf82 commit a5089ca

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Google_News.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
from urllib.request import urlopen
55

66
def news(xml_news_url):
7-
7+
'''Print select details from a html response containing xml
8+
@param xml_news_url: url to parse
9+
'''
810
Client=urlopen(xml_news_url)
911
xml_page=Client.read()
1012
Client.close()
@@ -15,10 +17,10 @@ def news(xml_news_url):
1517

1618
for news in news_list:
1719

18-
print(news.title.text)
19-
print(news.link.text)
20-
print(news.pubDate.text)
21-
print("\n\n")
20+
print(f'news title: {news.title.text}')
21+
print(f'news link: {news.link.text}')
22+
print(f'news pubDate: {news.pubDate.text}')
23+
print("+-"*20,"\n\n")
2224

2325

2426

0 commit comments

Comments
 (0)