automating control-D

Daniel Fackrell dfackrell at DELETETHIS.linuxmail.org
Fri Jul 26 15:30:05 EDT 2002


> "Victor Chen" vchen at meetingmaker.com> wrote in message
> news:mailman.1027708758.17684.python-list at python.org...
> Hi,
>     I'm fairly new a python stuff, working on my first python script. I
was wondering if anyone knows how I can represent control-D as output using
python. Firstly, I do not know the special string used to represent the
control key and secondly, I would have to automate both the control and the
d characters be pressed together. Any help is appreciated. Thank you.
>
> Victor

Ctrl-A through Ctrl-Z generally translate to ASCII characters 1-26 in order,
so Ctrl-D is ASCII character 4.

chr(4)

might do what you want, but might not, too.  Programs can choose to only
treat Ctrl-D specially if the input stream comes from a terminal.

--
Daniel Fackrell (dfackrell at linuxmail.org)
When we attempt the impossible, we can experience true growth.





More information about the Python-list mailing list