123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- # -*- coding: utf-8 -*-
- # @Author: wangkun
- # @Time: 2022/3/31
- from datetime import date, timedelta
- import datetime
- import time
- class Demo:
- @classmethod
- def demo1(cls):
- download_video_resolution = "720*1280"
- download_video_width = download_video_resolution.split("*")[0]
- download_video_height = download_video_resolution.split("*")[-1]
- print(download_video_resolution)
- print(download_video_width)
- print(download_video_height)
- @classmethod
- def time(cls):
- # 推荐
- time1 = int(time.time() * 1000)
- print(time1)
- # 不推荐
- time2 = round(time.time()) * 1000
- print(time2)
- # 统一获取当前时间
- now = datetime.datetime.now()
- print(type(now))
- print(f"now:{now}")
- # 昨天
- yesterday = (date.today() + timedelta(days=-1)).strftime("%Y-%m-%d")
- print(type(yesterday))
- print(f"昨天:{yesterday}")
- # 今天
- today = date.today()
- print(type(today))
- print(f"今天:{today}")
- # 明天
- tomorrow = (date.today() + timedelta(days=1)).strftime("%Y-%m-%d")
- print(type(tomorrow))
- print(f"明天:{tomorrow}")
- @classmethod
- def demo2(cls):
- s = "0"
- print(int(int(s) / 10))
- if __name__ == "__main__":
- demo = Demo()
- # demo.demo1()
- demo.time()
- pass
|