How do I do this with datetime and getpage in Python?

Problems are currently occurring -

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 abc to change to the name of the month before it tries to get the page, but everything I try is giving some error.

How can i do this?

Thanks!

0


a source to share


3 answers


Will this work?



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

      

+2


a source


The URL format is actually Wikiquote:Quote_of_the_day/Month

. Try the following:



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

      

+3


a source


Have you tried this:

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

      

0


a source







All Articles