第五周

import time
now = time.time()
now_gmtime = time.gmtime(now)
nowtime = time.strftime("%Y-%m-%d %H:%M:%S", now_gmtime)
print(nowtime)
import time
current=time.time()
current_time = time.gmtime(current)
format1 = time.strftime("%Y-%m-%d %H:%M:%S", current_time)
print("Format 1:", format1)
format2 = time.strftime("%m/%d/%Y %H:%M:%S", current_time)
print("Format 2:", format2)
format3 = time.strftime("%A, %B %d, %Y %H:%M:%S", current_time)
print("Format 3:", format3)
format4 = time.strftime("%d-%m-%Y %H:%M:%S", current_time)
print("Format 4:", format4)
format5 = time.strftime("%Y/%m/%d %H:%M:%S", current_time)
print("Format 5:", format5)
import time
scale =10
print("------执行开始------")
start=time.perf_counter()
for i in range(scale+1):
a,b='**'i,'..'(scale-i)
c=(i/scale)100
dur=time.perf_counter()-start
print("%{:❤️.0f}[{}->{}]{:.2f}s".format(c,a,b,dur))
time.sleep(0.1)
print("------执行结束------")
import time
start=time.perf_counter()
for i in range(101):
dur=time.perf_counter()-start
print("\r{:3}%{:.2f}s" .format(i,dur),end='')
time.sleep(0.05)
import time
scale=36
start=time.perf_counter()
print("执行开始".center(scale//2,'-'))
for i in range(scale+1):
a='
'i
dur=time.perf_counter()-start
b='.'
(scale-i)
c=(i/scale)*100
print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c,a,b,dur),end='')
time.sleep(0.05)
print("\n"+"执行结束".center(scale//2,'-'))
import time
str=("Starting ... Done!")
for i in range(len(str)):
print("{}".format(str[i]),end='')
while True:
for i in ["/", "-", "|", "\", "|"]:
print("%s\r" % i, end="")
from tqdm import tqdm
from time import sleep
for i in tqdm(range(100)):
sleep(0.01)

posted @ 2025-03-30 15:26  XiaoguoLu  阅读(16)  评论(0)    收藏  举报