zoukankan      html  css  js  c++  java
  • python的各种time

    time.localtime()  这是获取本地时间    打印出来的话是时间元组

    time.striptime()   这是把字符串转为时间数组

    比如
    >>> time.strptime('1990-1-1','%Y-%m-%d')
    time.struct_time(tm_year=1990, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=1, tm_isdst=-1)
     
     
    time.strftime()   这是格式化的时间字符串    自己输入的‘input’转时间元组所以是strptime,想要格式化’format‘输出时间的就是strftime

    datetime模块

    datetime模块包含datetime类   from datetime import datetime

    参考自:https://blog.csdn.net/qq_42336573/article/details/84063286

         https://www.cnblogs.com/laidaili/p/7614405.html

  • 相关阅读:
    win中使用curl上传文件报错
    S2-052
    S2-048
    S2-045、S2-046
    S2-033、S2-037
    S2-032
    S2-029
    day12-python之深灰魔法
    day10-11-python基础之字符串
    day09-python基础
  • 原文地址:https://www.cnblogs.com/wind666/p/11170491.html
Copyright © 2011-2022 走看看