Home  >  Article  >  Backend Development  >  Python example of how to get the day of the week a certain day is

Python example of how to get the day of the week a certain day is

高洛峰
高洛峰Original
2017-02-21 10:33:552136browse

The example in this article describes how Python gets the day of the week that a certain day is. Share it with everyone for your reference, the details are as follows:

Here we take the Spring Festival of 2017 (January 28) as an example:

import re;
import time;
import datetime;
if(__name__=="__main__"):
  #today=int(time.strftime("%w"));
  anyday=datetime.datetime(2017,1,28).strftime("%w");
  print anyday

The running effect diagram is as follows:

Python example of how to get the day of the week a certain day is

For more examples of Python methods to get the day of the week for a certain day, please pay attention to the PHP Chinese website for related articles!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn