Tag: python charset

파이썬, UnicodeDecodeError

파이썬에서 os 명령어를 실행하는 프로그램을 작성하고 실행할때, 때때로 아래와 같은 오류가 발생했다. python3.6 code: import subprocess def linux_cmd(cmd, s): s = s.strip() p = subprocess.Popen([cmd, s], stdout=subprocess.PIPE) r = p.communicate() return r[0] if __name__==’__main__’: k = linux_cmd(‘cat’, ‘a.txt’) print(k)

Continue reading