python:console
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판다음 판 | 이전 판 | ||
| python:console [2016/08/09 06:08] – rex8312 | python:console [2024/03/23 02:42] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 2: | 줄 2: | ||
| ===== 컬러 문자 출력 ===== | ===== 컬러 문자 출력 ===== | ||
| - | | + | |
| + | | ||
| + | * https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| ===== ascii문자로 plotting ===== | ===== ascii문자로 plotting ===== | ||
| * http:// | * http:// | ||
| * gnuplot 사용 | * gnuplot 사용 | ||
| - | * ++ 예제| | + | * 예제 |
| <code python ascii_plot.py> | <code python ascii_plot.py> | ||
| - | def ascii_plot(xs, | + | def ascii_plot(xs, |
| import subprocess | import subprocess | ||
| - | | + | |
| - | input_string = "set term dumb 79 25\n" | + | if platform.system().lower() == ' |
| + | path = ' | ||
| + | else: | ||
| + | path = "/ | ||
| + | gnuplot = subprocess.Popen([path], | ||
| + | stdin=subprocess.PIPE, | ||
| + | stdout=subprocess.PIPE, | ||
| + | | ||
| + | input_string = "set term dumb 90 25\n" | ||
| input_string += "set key off\n" | input_string += "set key off\n" | ||
| - | input_string += "plot ' | + | |
| - | for i, j in zip(xs, ys): | + | if not hasattr(ys[0], |
| - | input_string += "%f %f\n" % (i, j) | + | ys_list = [ys] |
| - | input_string += " | + | else: |
| + | ys_list = ys | ||
| + | |||
| + | | ||
| + | input_string += ', ' | ||
| + | input_string += '\n' | ||
| + | |||
| + | | ||
| + | | ||
| + | input_string += "%f %f\n" % (i, j) | ||
| + | input_string += " | ||
| output_string, | output_string, | ||
| + | |||
| + | if title is not None: | ||
| + | title = '** {} **\n' | ||
| + | output_string = title + output_string | ||
| + | |||
| + | if print_out: | ||
| + | print(output_string) | ||
| + | | ||
| return output_string | return output_string | ||
| 줄 33: | 줄 64: | ||
| sleep(1) | sleep(1) | ||
| </ | </ | ||
| - | ++ | ||
| ===== 프로그래스 바 출력 ===== | ===== 프로그래스 바 출력 ===== | ||
| * https:// | * https:// | ||
| * https:// | * https:// | ||
| + | |||
| + | ===== TUI ===== | ||
| + | |||
| + | * http:// | ||
| + | * http:// | ||
python/console.1470722895.txt.gz · 마지막으로 수정됨: (바깥 편집)