initilize a memory zone in python

Grant Edwards grante at visi.com
Mon Aug 31 02:25:45 CEST 2009


On 2009-08-30, Mug <exallion.long at gmail.com> wrote:

> hello, i'm new in python, i used to program in C, i have a
> small problem, i tryed to do some serial port things

You're probably better off just using pyserial:

  http://pyserial.sourceforge.net/

If you really want to muck about with termios stuff, you can
look at the posix serial module in pyserial to see how it's
done.

> import sys,termios
>
> fd = sys.stdin.fileno()
> term_conf=termios.tcgetattr(fd);
>
> now i want to modify the actuall values in term_conf zone to
> zero

Have you looked at the documentation for termios.tcgettattr()?

It returns a list of integers.  If you want set them to zero,
then just set them to zero.

If you want a configuration that's all zeros, why bother
calling tcgetattr() at all?  Just set the configuration to
zeros:

term_conf = [0,0,0,0,0,0]

-- 
Grant




More information about the Python-list mailing list