내용으로 건너뛰기
Out of the Box
사용자 도구
로그인
사이트 도구
검색
도구
문서 보기
이전 판
Fold/unfold all
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
최근 바뀜
미디어 관리자
사이트맵
추적:
python:console
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
====== Python Console ====== ===== 컬러 문자 출력 ===== * [[https://github.com/willmcgugan/rich|rich]] * https://medium.com/trabe/building-rich-console-interfaces-in-python-16338cc30eaa * [[https://pypi.org/project/termcolor/|termcolor]] * [[https://pypi.python.org/pypi/colorama|colorama]] ===== ascii문자로 plotting ===== * http://stackoverflow.com/questions/20295646/python-ascii-plots-in-terminal * gnuplot 사용 * 예제 <code python ascii_plot.py> def ascii_plot(xs, ys, title=None, print_out=False): import subprocess import platform if platform.system().lower() == 'windows': path = 'C:/Program Files/gnuplot/bin/gnuplot.exe' else: path = "/usr/bin/gnuplot" gnuplot = subprocess.Popen([path], stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True) input_string = "set term dumb 90 25\n" input_string += "set key off\n" if not hasattr(ys[0], '__len__'): ys_list = [ys] else: ys_list = ys input_string += "plot " input_string += ', '.join(["'-' using 1:2 title 'Line1' with linespoints" for ys in ys_list]) input_string += '\n' for ys in ys_list: for i, j in zip(xs, ys): input_string += "%f %f\n" % (i, j) input_string += "e\n" output_string, error_msg = gnuplot.communicate(input_string) if title is not None: title = '** {} **\n'.format(title.title()) output_string = title + output_string if print_out: print(output_string) return output_string if __name__ == '__main__': from tqdm import tqdm from time import sleep for freq in tqdm(range(10)): import numpy as np xs = np.linspace(0, 2 * np.pi, 100) ys = np.sin(freq * xs) o = ascii_plot(xs, ys) tqdm.write(o) sleep(1) </code> ===== 프로그래스 바 출력 ===== * https://pypi.python.org/pypi/tqdm * https://pypi.python.org/pypi/progressbar2 ===== TUI ===== * http://urwid.org/ * http://npyscreen.readthedocs.io
python/console.txt
· 마지막으로 수정됨: 2024/03/23 02:42 저자
127.0.0.1
문서 도구
문서 보기
이전 판
역링크
Fold/unfold all
맨 위로