import time
result=0
start=time.time()
for i in range(1,10000001):
result+=i
end=time.time()
print(result)
print(end-start)
import time
t1=time.strptime('2020-1-30 15:00:00','%Y-%m-%d %H:%M:%S')
t2=time.localtime()
a=t1>t2
print(a)
from datetime import datetime
t=datetime.now()
print(t)
print(t.microsecond)
from datetime import datetime,timedelta
t1=timedelta(days=100,hours=1)
t2=datetime.now()
a=t2+t1
print(a)
try:
num = int(input('num:'))
result=100/num
print(result)
print('Done')
except ZeroDivisionError:
print('0不能做被除数')
except (ValueError,KeyboardInterrupt,EOFError):
print('类型不对')
python-time和datetime函数以及抓取报错
最新推荐文章于 2024-03-27 16:01:13 发布