python pexpect sendcontrol key characters -
I'm working with Python Packeters to automate the tasks, to use with the sender control Need help finding main characters, how can one send a control key? And how can we get key characters for future reference?
Here is the code that I'm working on.
#! / Usr / bin / env python imported pexeter id = pexpect.spawn ('ftp 192.168.3.140') Id.expect_exact ('name') id.sendline ('anonymous') id.expect_exact ('password') * # is sure How to Enter Control Key ID Codecontrol ('???') * id.expect_exact ('Ftp') id. Sendline ('dir') id.expect_exact ('ftp') line = id.before.split ('\ n') For: print line
Pax no sendcontrol () is not the method. In your example, you try to send an empty line. To do this, use it: id.sendline ('') If you need to send a real control letter, you can Send () is a string that contains the appropriate character value. For example, you want to send a control-c: id.send ('\ 003') or: < Pre> id.send (chr (3)) Comment # 2 Answer: Sorry, I typo ' Ed module name - now fixed, more importantly, I do not have old documents. The new document shows a sendcontrol () method. It takes a logic, which is a letter (for example, sendcontrol ('c') sends a control-c) or represents one of the distracted symbols controlled characters Letters which are not conformable are letters. But actually, there is a convenient cover when sending sendcontrol () , which happens after calculating the sendcontrol () call the actual value you want to send You can read the source for yourself. I do not understand why id.sendline ('') is not working, in particular it clearly works to send to the user The name of the spanned FTP program if you want to try using sendcontrol () , instead it will be: Id.sendcontrol ('j') to send a linefeed character (which is control-j, or decimal 10) or:
Id.sendcontrol ('m')
Comments
Post a Comment