Skip to content

Instantly share code, notes, and snippets.

View zwehrwein's full-sized avatar

Zach Wehrwein zwehrwein

  • Harvard Medical School
  • Cambridge MA
View GitHub Profile
@zwehrwein
zwehrwein / print_progress.py
Created January 31, 2018 01:23 — forked from ravishchawla/print_progress.py
A python function that can be used to print an ongoing progress bar.
import sys;
def print_progess(currentProgress, maxProgress, numberDashes, message = ""):
progress = numberDashes * (currentProgress / maxProgress) + 1;
dashes = "=" * int(progress) + "> "
percentage = int(100 * currentProgress / maxProgress) + 1;
if percentage > 100:
percentage = 100;
sys.stdout.write("\r " + "<" + message + "> " + dashes + "{0:.2f}".format(percentage) + "%");
sys.stdout.flush();
@zwehrwein
zwehrwein / print_progress.py
Created January 31, 2018 01:23 — forked from ravishchawla/print_progress.py
A python function that can be used to print an ongoing progress bar.
import sys;
def print_progess(currentProgress, maxProgress, numberDashes, message = ""):
progress = numberDashes * (currentProgress / maxProgress) + 1;
dashes = "=" * int(progress) + "> "
percentage = int(100 * currentProgress / maxProgress) + 1;
if percentage > 100:
percentage = 100;
sys.stdout.write("\r " + "<" + message + "> " + dashes + "{0:.2f}".format(percentage) + "%");
sys.stdout.flush();
@zwehrwein
zwehrwein / print_progress.py
Created January 31, 2018 01:23 — forked from ravishchawla/print_progress.py
A python function that can be used to print an ongoing progress bar.
import sys;
def print_progess(currentProgress, maxProgress, numberDashes, message = ""):
progress = numberDashes * (currentProgress / maxProgress) + 1;
dashes = "=" * int(progress) + "> "
percentage = int(100 * currentProgress / maxProgress) + 1;
if percentage > 100:
percentage = 100;
sys.stdout.write("\r " + "<" + message + "> " + dashes + "{0:.2f}".format(percentage) + "%");
sys.stdout.flush();
@zwehrwein
zwehrwein / print_progress.py
Created January 31, 2018 01:23 — forked from ravishchawla/print_progress.py
A python function that can be used to print an ongoing progress bar.
import sys;
def print_progess(currentProgress, maxProgress, numberDashes, message = ""):
progress = numberDashes * (currentProgress / maxProgress) + 1;
dashes = "=" * int(progress) + "> "
percentage = int(100 * currentProgress / maxProgress) + 1;
if percentage > 100:
percentage = 100;
sys.stdout.write("\r " + "<" + message + "> " + dashes + "{0:.2f}".format(percentage) + "%");
sys.stdout.flush();
@zwehrwein
zwehrwein / print_progress.py
Created January 31, 2018 01:23 — forked from ravishchawla/print_progress.py
A python function that can be used to print an ongoing progress bar.
import sys;
def print_progess(currentProgress, maxProgress, numberDashes, message = ""):
progress = numberDashes * (currentProgress / maxProgress) + 1;
dashes = "=" * int(progress) + "> "
percentage = int(100 * currentProgress / maxProgress) + 1;
if percentage > 100:
percentage = 100;
sys.stdout.write("\r " + "<" + message + "> " + dashes + "{0:.2f}".format(percentage) + "%");
sys.stdout.flush();