python and I/O

Bill Rodgers Bill at nospam.com
Sat Sep 25 13:57:03 EDT 1999


I don't see how reading and writing to a file descriptor
provides access to serial ports, parallel ports or memory
mapped I/O.  Usually serial ports require more specific
setup criteria such as baud rate, character format (N-8-1, etc).

>
> use the open() builtin:
> NULL = open('/dev/null', 'w')
> NULL.write("This is being written to /dev/null")
> ZERO = open("/dev/zero", 'r')
> nulls = ZERO.read(5)
> print nulls # gives "\0\0\0\0\0"
>
> regards,
> Gerrit.
> --
> RTFM: Read That FreshMeat
>
>






More information about the Python-list mailing list