python:console
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
python:console [2015/07/03 00:00] – 만듦 rex8312 | python:console [2024/03/23 02:42] (현재) – 바깥 편집 127.0.0.1 | ||
---|---|---|---|
줄 1: | 줄 1: | ||
====== Python Console ====== | ====== Python Console ====== | ||
+ | ===== 컬러 문자 출력 ===== | ||
+ | |||
+ | * [[https:// | ||
+ | * https:// | ||
+ | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | |||
+ | ===== ascii문자로 plotting ===== | ||
+ | * http:// | ||
+ | * gnuplot 사용 | ||
+ | * 예제 | ||
+ | <code python ascii_plot.py> | ||
+ | def ascii_plot(xs, | ||
+ | import subprocess | ||
+ | import platform | ||
+ | if platform.system().lower() == ' | ||
+ | path = ' | ||
+ | else: | ||
+ | path = "/ | ||
+ | gnuplot = subprocess.Popen([path], | ||
+ | | ||
+ | | ||
+ | | ||
+ | input_string = "set term dumb 90 25\n" | ||
+ | input_string += "set key off\n" | ||
+ | | ||
+ | if not hasattr(ys[0], | ||
+ | ys_list = [ys] | ||
+ | else: | ||
+ | ys_list = ys | ||
+ | |||
+ | input_string += "plot " | ||
+ | input_string += ', ' | ||
+ | input_string += ' | ||
+ | |||
+ | for ys in ys_list: | ||
+ | for i, j in zip(xs, ys): | ||
+ | input_string += "%f %f\n" % (i, j) | ||
+ | input_string += " | ||
+ | |||
+ | output_string, | ||
+ | |||
+ | if title is not None: | ||
+ | title = '** {} **\n' | ||
+ | output_string = title + output_string | ||
+ | |||
+ | if print_out: | ||
+ | print(output_string) | ||
+ | | ||
+ | return output_string | ||
+ | |||
+ | |||
+ | if __name__ == ' | ||
+ | from tqdm import tqdm | ||
+ | from time import sleep | ||
+ | for freq in tqdm(range(10)): | ||
+ | import numpy as np | ||
+ | xs = np.linspace(0, | ||
+ | ys = np.sin(freq * xs) | ||
+ | o = ascii_plot(xs, | ||
+ | tqdm.write(o) | ||
+ | sleep(1) | ||
+ | </ | ||
+ | |||
+ | ===== 프로그래스 바 출력 ===== | ||
+ | * https:// | ||
+ | * https:// | ||
+ | |||
+ | ===== TUI ===== | ||
+ | |||
+ | * http:// | ||
+ | * http:// |
python/console.1435881648.txt.gz · 마지막으로 수정됨: (바깥 편집)