python学习小记

 

python将字符串转换成日期格式:

import datetime
a='20120101'
x=datetime.datetime.strptime(a,'%Y%m%d')
x.strftime('%d-%b-%y')
'01-Jan-12'