#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http

제목file 수업2020-05-07 16:07
작성자

file_examples = open('file_examples.txt','r')

file_examples.readline()

data =file_examples.readline().strip()
while data.startswith('#'):
    data = file_examples.readline().strip()

for data in file_examples:
    print(data)

file_examples.close()


코드는 다음과 같고 file_examples.txt  또한


데헷
#데헷
#데헷
#데헷
#데헷
23
48
12
5
 

이렇게 써넣고

동일한 폴더 안에 txt 파일과 py 파일을 같이 넣고 실행시켰습니다.


Traceback (most recent call last):
  File "C:/Users/snagh/Desktop/과제 제출/웹프로그래밍/file_examples/file_examples.py", line 3, in <module>
    file_examples.readline()
UnicodeDecodeError: 'cp949' codec can't decode byte 0xeb in position 0: illegal multibyte sequence


이런 메세지가 뜨는데 이건 뭐때문인가요?



댓글