layout: post title: Python 常用资源 category: 资源 tags: Python keywords: Python
for key in a.__dict__:
print key,':',a.__dict__[key]
assert False //引发异常,观察错误界面
import logging
logging.info('') //写日志
#时间戳
time.time()
#日期时间
time.ctime()
#iso时间
datetime.fromtimestamp(time.time()).isoformat()
#固定格式
time.strftime('%Y-%m-%d',time.localtime(time.time()))
dateC=datetime.datetime(2010,6,6,8,14,59)
timestamp=time.mktime(dateC.timetuple())
ltime=time.localtime(1237515355.0)
timeStr=time.strftime("%Y-%m-%d %H:%M:%S", ltime)
from __future__ import absolute_import