I try to remove seconds from date:
>>> import datetime
>>> test1 = datetime.datetime(2011, 6, 10, 0, 0)
>>> test1
datetime.datetime(2011, 6, 10, 0, 0)
>>> str(test1)
'2011-06-10 00:00:00'
>>> str(test1).rstrip('00:00:00')
'2011-06-10 '
>>> str(test1).rstrip(' 00:00:00')
'2011-06-1'
Why 0 at end of '10' is removed?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…