program/python

[python] text 파일 읽기

momoa210 2024. 1. 28. 17:08

 

기본 옵션 

open("data/chicken.txt", 'r')

 

 

한글이 있는 경우

with open("data/chicken.txt", 'r', encoding='utf-8') as f:
    for line in f:
        print(line.strip())

'program > python' 카테고리의 다른 글

[python] 파워셀에서 실행하기  (0) 2024.01.28
[python] 파일 쓰기  (0) 2024.01.28
[python] strip  (0) 2024.01.28
[python] 리스트와 문자열  (0) 2024.01.28
[python] aliasing  (0) 2024.01.28