repr
>>> import datetime >>> today=datetime.datetime.now() >>> today datetime.datetime(2015, 10, 12, 20, 33, 19, 634000) >>> type(today) <type 'datetime.datetime'> >>> #type(today)这是一个时间类型的数据 >>> str(today) '2015-10-12 20:33:19.634000' >>> type(str(today)) <type 'str'> >>> repr(today)#将时间类型的对象转化为可打印的字符串,原对象不做任何的改变 'datetime.datetime(2015, 10, 12, 20, 33, 19, 634000)' >>> type(repr(today)) <type 'str'> >>> eval(repr(today)) datetime.datetime(2015, 10, 12, 20, 33, 19, 634000) >>>
无语言基础,自学python所做的各种笔记,欢迎大牛指点.