文件名称:Python3.7.1
文件大小:24.78MB
文件格式:ZIP
更新时间:2022-01-18 14:58:39
Python语言
import random import time import sys from multiprocessing import Process def processBar_tortoise(num, total, name_icon): # 进度条 rate = num / total rate_num = int(rate * 100) s = '起点 ' + '> ' * (total-2) + '终点' if rate_num == 100: s = s.split() s[num] = name_icon y = ''.join(s) r = '\r{}\n'.format(y) else: s = s.split() s[num] = name_icon y = ''.join(s) r = '\r{}'.format(y) sys.stdout.write(r) sys.stdout.flush def processBar_hare(num, total, name_icon): # 进度条 rate = num / (total+1) rate_num = int(rate * 100) s = '起点 ' + '> ' * (total-3) + '终点' if rate_num == 100: s = s.split() s[num] = name_icon y = ''.join(s) r = '\r{}\n'.format(y) else: s = s.split() s[num] = name_icon y = ''.join(s) r = '\r{}'.format(y) sys.stdout.write(r) sys.stdout.flush def tortoise(total_step): start_time = time.time() step = 0 while step < total_step: time.sleep(0.2) step += 1 processBar_tortoise(step, total_step+1, '
【文件预览】:
python-3.7.1-amd64.exe