Python 实例——进度条,文件读取

时间:2021-06-13 19:31:58

进度条:

 import sys
import time for i in range(50):
sys.stdout.write("*")
sys.stdout.flush()
time.sleep(0.1)

文件读取(效率高效的读取大文件方法,一行读取后释放内存):

 count = 0
for line in f:
if count == 9:
print("------我是分割线------")
count += 1
continue
print(line)
count += 1