Update Readme based on #44

This commit is contained in:
Benedek Racz 2021-02-01 10:30:32 +01:00 committed by GitHub
parent b0d4abdd44
commit 03499c73e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,11 +25,16 @@ To interract with a child process use `spawn` method:
```python
import wexpect
prompt = '[A-Z]\:.+>'
child = wexpect.spawn('cmd.exe')
child.expect('>')
child.sendline('ls')
child.expect('>')
print(child.before)
child.expect(prompt) # Wait for startup prompt
child.sendline('dir') # List the current directory
child.expect(prompt)
print(child.before) # Print the list
child.sendline('exit')
```