标签:
1.获取路径
import os,sys #获取全部路径 print(os.path.abspath(__file__)) #获取目录 print(os.path.dirname(os.path.abspath(__file__))) #获取文件名 print(os.path.basename(__file__))
2.时间模块time、datetime
#时间戳-->struct_time print(time.time()) print(time.gmtime(time.time())) #struct_time-->时间戳 print(time.localtime()) print(time.mktime(time.localtime())) #字符串-->struct print(time.strptime("20150505","%Y%m%d")) #struct-->字符串 print(time.strftime("%Y%m%d",time.localtime()))
标签:
原文地址:http://www.cnblogs.com/weibiao/p/5274098.html