pj_0004_time_swap
作者:互联网
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import time
def _get_strftime_( t ): return time.strftime("%Y%m%d %H:%M:%S", time.localtime(t))
def _get_mktime_( s, mode=0 ): if mode == 1: t = time.mktime( time.strptime(s, "%Y%m%d") ) else: t = time.mktime( time.strptime(s, "%Y%m%d %H:%M:%S") ) return t
def _main_func_(): print(time.time(), time.strftime("%Y%m%d %H:%M:%S")) print("welcome, please input your order") print("mk for mktime, str for strftime") ipt = input() print("input para") i = input()
if ipt == "mk": print( _get_mktime_(i) ) elif ipt == 'str': print( _get_strftime_(float(i)) )
def _test(): print('hello') if __name__ == '__main__': _main_func_()
import time
def _get_strftime_( t ): return time.strftime("%Y%m%d %H:%M:%S", time.localtime(t))
def _get_mktime_( s, mode=0 ): if mode == 1: t = time.mktime( time.strptime(s, "%Y%m%d") ) else: t = time.mktime( time.strptime(s, "%Y%m%d %H:%M:%S") ) return t
def _main_func_(): print(time.time(), time.strftime("%Y%m%d %H:%M:%S")) print("welcome, please input your order") print("mk for mktime, str for strftime") ipt = input() print("input para") i = input()
if ipt == "mk": print( _get_mktime_(i) ) elif ipt == 'str': print( _get_strftime_(float(i)) )
def _test(): print('hello') if __name__ == '__main__': _main_func_()
标签:0004,__,mktime,m%,print,swap,time,pj,strftime 来源: https://www.cnblogs.com/xiaoconghua/p/15829960.html