본문 바로가기
Programming

UnicodeEncodeError: 'ascii' codec can't encode characters in position : ordinal not in range(128)

by leanu 2011. 6. 17.

원인 : Python은 기본 8bits char를 가정한다. string내부에 2byte character가 있는경우 에러 발생한다.

해결 : .encode("ENCODE_TYPE") 를 스트링 뒤에 붙이면 된다.
   (ex) fpout.write( str.encode("utf-8") ) 

'Programming' 카테고리의 다른 글

[Python] Power User  (0) 2012.07.21
[python] isVowel() and getVowelCount()  (0) 2011.08.29
PostgreSQL  (0) 2011.05.03
Syntax Highlighter 3.0을 Tistory에 적용하다.  (0) 2011.01.12
자주 사용하는 스크립트 모음  (0) 2010.12.21

댓글