get timestamp from the api of wikipedia in python

Assuming the loop will loop through multiple pages correctly as the code stands, you can change the for loop to:

for page in PAGES:
    date = PAGES[page]['revisions'][0]['timestamp']

    # Example date = 2002-06-16T13:40:19Z' Split on T to get the YYYY-MM-DD first
    formatted_date  = date.split("T")[0] 

    print(formatted_date)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top