반응형
250x250
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
Tags
- codedeploy
- codedeploy error
- codebuild
- kubeflow
- 도커
- Kafka
- PostgreSQL
- Airflow
- redis
- codepipeline
- AWS CI/CD 구축하기
- VPN
- SQL
- Flux
- Spring
- Spring Error
- openlens
- docker
- IntelliJ
- aws
- Python
- aws cicd
- COALESCE
- Jenkins
- node
- bootstrap
- chartjs
- chart.js
- JavaScript
- java bigdecimal
Archives
- Today
- Total
Small Asteroid Blog
[파이썬 한글깨짐] 'cp949' codec can't decode byte 0xa9 in position 8: illegal multibyte sequence 본문
백엔드/Python
[파이썬 한글깨짐] 'cp949' codec can't decode byte 0xa9 in position 8: illegal multibyte sequence
작은소행성☄️ 2020. 6. 9. 14:30728x90
파일을 오픈하다가
'cp949' codec can't decode byte 0xa9 in position 8: illegal multibyte sequence
다음과 같은 에러를 마주칠 때가 있다.
한글 인코딩 문제인데
1. 상단에 #-*- coding:utf-8 -*- 추가하기
2. 파일 wirte 시 encoding해주기
encoding="utf-8-sig"
utf-8뒤에 -sig를 추가 해주어야 할 때가 있고 추가하지 않아도 될 때가 있음
f=open("project.csv","w",encoding="utf-8-sig")
3. 파일 read 시
data1 = open("c:\\Users\\user\\PycharmProjects\\Project.csv","r",encoding="utf-8").read()
encoding="utf-8" 을 추가해주어야 함
encoding= 부분을 꼭 적어주어야함
728x90
반응형
'백엔드 > Python' 카테고리의 다른 글
| [python] not all arguments converted during string formatting (0) | 2020.09.28 |
|---|---|
| (오류) (2003, "Can't connect to MySQL server on 'root' ([Errno 11001] getaddrinfo failed)") (0) | 2020.09.28 |
| (크롤링) 파이썬 mariadb 연동하기 (0) | 2020.09.25 |
| [python] Konlpy - No such file or directory: '/usr/lib/jvm' (0) | 2020.09.15 |
| 파이썬으로 워드 클라우드 만들기 (카카오톡 대화내용) (0) | 2020.07.30 |