python and I/O
Gerrit Holl
gerrit.holl at pobox.com
Sat Sep 25 07:03:46 EDT 1999
Mike Linnen:
> I am very new to python. I was wondering if the python lang allows access
> to I/O ports. I would like to use the lang in a robotics application and I
> need to do some data acquisition. I could write some C extensions to python
> but I would like to know if it currently supports I/O.
>
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