Tutorial :How to do this with datetime & getpage in Python?



Question:

Currently having some problems-

now = datetime.datetime.now()  month = now.strftime("%B")      site = wikipedia.getSite('en', 'wikiquote')  page = wikipedia.Page(site, u"Wikiquote:Quote_of_the_day:abc")  

I need to get abc to change into the name of the month before it then tries to get the page, yet everything I try it gives an error of some sort.

How could I do it?

Thanks!


Solution:1

Would this work?

page = wikipedia.Page(site, u"Wikiquote:Quote_of_the_day:" + month)  


Solution:2

The page URL format is actually Wikiquote:Quote_of_the_day/Month. Try this:

page = wikipedia.Page(site, u"Wikiquote:Quote_of_the_day/%s" % month)  


Solution:3

Did you try this:

page = wikipedia.Page(site, u"Wikiquote:Quote_of_the_day:%s" % month )  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »