Write binary data to standard error?
Saptarshi
saptarshi.guha at gmail.com
Wed Aug 12 22:44:38 EDT 2009
On Aug 12, 10:32 pm, sapsi <saptarshi.g... at gmail.com> wrote:
> Hello,
> This is probably a basic question, but how does one write binary data
> to standard error e.g int as network order (4 bytes)?
>
> Much thanks
> Saptarshi
Solved:
import sys
import os
from struct import *
d=os.fdopen(sys.stderr.fileno(),"wb")
d.write("\x00")
d.write(pack(">i",5))
More information about the Python-list
mailing list