acrs
acrs

Reputation: 563

how to send ctrl a+c using python?

I need to find out how to send ctrl a+c using python to make a new screen using GNU Screen I'm lost i have not found any code that will get this working. I need to control GNU Screen using python.

More info http://lifehacker.com/5652409/how-to-run-multiple-applications-in-a-single-terminal-window

Upvotes: 2

Views: 2985

Answers (1)

Michał Šrajer
Michał Šrajer

Reputation: 31192

try with sendcontrol() from pexpext module.

import pexpect

child = pexpect.spawn ('screen')
child.sendcontrol('a');
child.send('c');

The documentation has many examples.

Upvotes: 1

Related Questions