티스토리 뷰
Normal printing to the terminal means printing to "standard output"
결과가 저장될 파일명을 따로 지정해주지 않았을 경우, 결과를 터미널 창에 뿌려주도록 하는 함수는 다음과 같다.
def write_file(items, fn=None):
"""Write file
items - list of string
fn - name of output file, string (fn=None: standard output)
"""
if fn:
out = open(fn,'w')
for item in items:
if fn:
out.write("{}".format(item)
else:
print("{}".format(item))
if fn:
out.close()
return None
'python' 카테고리의 다른 글
python | 문자열 리스트를 숫자열 리스트로 변환 하기 (0) | 2020.08.05 |
---|---|
python | format 함수를 사용하지 않고 10진수를 2진수로 변환하기 (0) | 2020.08.05 |
python | format 함수를 사용한 2진수 8진수 16진수 변환 (0) | 2020.08.05 |
python | 재귀함수(recursive function)를 이용한 팩토리얼(factorial) (0) | 2020.08.03 |
python | if 조건문 없이 짝수번, 홀수번 찾는 더욱 간단한 방법 (0) | 2020.07.31 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- visualizing
- Heatmap
- BIOINFORMATICS
- Command
- Visualization
- SEQ
- Python
- coronavirus
- plot
- covid
- 코로나바이러스
- Cast
- data
- geom_bar
- hist
- 데이터
- 팟빵
- Excel
- comma
- Order
- Coding
- format
- RStudio
- 2진수
- 엑셀
- 파이썬
- r
- for loop
- 숫자
- geom_line
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함