파이썬 2.x에서는 다음과 같이 할 수 있습니다.
import sys, array
a = array.array('B', range(100))
a.tofile(sys.stdout)
그러나 이제 나는 TypeError: can't write bytes to text stream. 사용해야하는 비밀 인코딩이 있습니까?
4
파이썬 2.6+ 및 3.x와 함께 작동합니다 답변 찾기 위해 더 나은 것
—
소린
os.writePy2와 Py3 모두에서 작동합니다.