0

If there is another way to show the progress through some other function?

with open(filename, 'r', encoding='utf-8') as f:
    contents = f.read()
smci
  • 32,567
  • 20
  • 113
  • 146
  • What goes wrong when you try to use `tqdm`? per [Python enumerate() tqdm progress-bar when reading a file?](https://stackoverflow.com/questions/48437189/python-enumerate-tqdm-bar-when-reading-a-file). Also, here is link to [tqdm doc](https://github.com/tqdm/tqdm). – smci Feb 14 '21 at 05:40

1 Answers1

2

It may help you.

import os
from tqdm import tqdm

with tqdm(total=os.path.getsize(file)) as pbar:
   with open(file, "rb") as f:
      for l in f:
          pbar.update(len(l))
          ...

From https://stackoverflow.com/a/51693787

Grid
  • 41
  • 5