标签:bsp sharp erro syntax 代码 今天 输出 syn image
>>> import datetime >>> datetime.datetime.now() datetime.datetime(2017, 9, 30, 9, 6, 45, 542000) >>> from datetime import datetime >>> now=datetime.now() >>> now datetime.datetime(2017, 9, 30, 9, 6, 59, 310000) >>> KeyboardInterrupt >>> utcnow=datetime.utcnow() >>> utcnow SyntaxError: unexpected indent >>> KeyboardInterrupt >>> utcnow datetime.datetime(2017, 9, 30, 1, 7, 21, 933000) >>> now.month 9 >>> now.year 2017 >>> d=datetime(2014,2,1) >>> d datetime.datetime(2014, 2, 1, 0, 0) >>> d.isoformat() ‘2014-02-01T00:00:00‘ >>> d.isoweekday() 6 >>> KeyboardInterrupt >>> s=datetime.strptime(‘2017/9/30‘,‘%Y/%m/%d‘) >>> s datetime.datetime(2017, 9, 30, 0, 0) >>> datetime.strptime(‘2017年9月30日星期六‘,‘%Y年%m月%d日星期六‘) datetime.datetime(2017, 9, 30, 0, 0) >>> datetime.strptime(‘2017年9月30日星期六8时42分24秒‘,‘%Y年%m月%d日星期六%H时%M分%S秒‘) datetime.datetime(2017, 9, 30, 8, 42, 24) >>> datetime.strptime(‘9/30/2017‘,‘%m/%d/%Y‘) datetime.datetime(2017, 9, 30, 0, 0) >>> datetime.strptime(‘9/30/2017 8:42:50‘,‘%m/%d/%Y %H:%M:%S‘) datetime.datetime(2017, 9, 30, 8, 42, 50) >>>
from datetime import datetime f1=datetime(2017,9,28,10,3,43) print(f1.strftime(‘%Y年%m月%d日%A%H时%M分%S秒‘)) f2=datetime(2017,9,30) print(f2.strftime(‘%A,%B %d,%Y‘)) f3=datetime(2017,9,30,9,22,17) print(f3.strftime(‘%m/%d/%Y %I:%M:%S %p‘)) print(f2.strftime(‘%B %d,%Y‘))
from datetime import datetime now =datetime.now() print(now.strftime(‘今天是%Y年%m月%d日‘)) print(now.strftime(‘今天是这周的第%w天‘)) print(now.strftime(‘今天是今年的第%j天‘)) print(now.strftime(‘今周是今年的第%W周‘)) print(now.strftime(‘今天是当月的第%d天‘))
标签:bsp sharp erro syntax 代码 今天 输出 syn image
原文地址:http://www.cnblogs.com/zhangmuqing/p/7613709.html