IT개발/Python(파이썬)2010. 8. 25. 15:40
python 은 기본적을 한글 인코딩 방식을 지원하지 않는다.

그래서 소스에 한글이 들어가면 다음과 같은 경고(warning)가 발생한다.
[citylock@nmsfile thread]$ ./makeChildProcess.py
sys:1: DeprecationWarning: Non-ASCII character '\xc0' in file ./makeChildProcess.py on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
원래 프로세스 :

이를 해결하는 방법은 소스 코드 앞단에 인코딩 방식을 명시해 주는 것이다.
#!/usr/bin/python
# -*- coding: utf-8 -*-

# makeChildProcess.py : 자식 프로세스 생성
import os

print "원래 프로세스 : "

(실행결과)
[citylock@nmsfile thread]$ ./makeChildProcess.py
원래 프로세스 :



Posted by 시티락