日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Py之reprint:reprint的简介、安装、使用方法之详细攻略

發布時間:2025/3/21 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Py之reprint:reprint的简介、安装、使用方法之详细攻略 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Py之reprint:reprint的簡介、安裝、使用方法之詳細攻略

?

?

目錄

reprint的簡介

reprint的安裝

reprint的使用方法


?

?

?

reprint的簡介

? ? ? reprint 是一個適用于 Python3 的簡易變量綁定與多行輸出刷新的庫。特性 + 簡易變量綁定,內容修改時自動刷新命令行輸出 + 多行輸出刷新,實現不同行內容由獨立變量控制,修改特定變量即能刷新命令行中特定行的內容 + 多線程安全,使用了 threading.Lock 實現線程安全 + 無外部庫依賴。

py pi地址:https://pypi.org/project/reprint/

?

?

reprint的安裝

pip install reprint

reprint的使用方法

1、官方示例

import time import random import threadingfrom reprint import outputdef some_op(index=0):LENGTH = 100global output_listnow = 0while now < LENGTH:max_step = LENGTH-nowstep = random.randint(1, max_step or 1)now += stepoutput_list[index] = "{}{}{padding}{ending}".format("-" * now,index,padding=" " * (LENGTH-now-1) if now < LENGTH else "",ending="|" if now < LENGTH else "")time.sleep(1)output_list.append("{} finished".format(index))with output(output_type="list", initial_len=5, interval=0) as output_list:pool = []for i in range(5):t = threading.Thread(target=some_op, args=(i,))t.start()pool.append(t)[t.join() for t in pool]

?

總結

以上是生活随笔為你收集整理的Py之reprint:reprint的简介、安装、使用方法之详细攻略的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。