mirror of
https://github.com/clearml/wexpect-venv
synced 2025-01-31 02:46:59 +00:00
Update Readme based on #44
This commit is contained in:
parent
b0d4abdd44
commit
03499c73e2
13
README.md
13
README.md
@ -25,11 +25,16 @@ To interract with a child process use `spawn` method:
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
import wexpect
|
import wexpect
|
||||||
|
|
||||||
|
prompt = '[A-Z]\:.+>'
|
||||||
|
|
||||||
child = wexpect.spawn('cmd.exe')
|
child = wexpect.spawn('cmd.exe')
|
||||||
child.expect('>')
|
child.expect(prompt) # Wait for startup prompt
|
||||||
child.sendline('ls')
|
|
||||||
child.expect('>')
|
child.sendline('dir') # List the current directory
|
||||||
print(child.before)
|
child.expect(prompt)
|
||||||
|
|
||||||
|
print(child.before) # Print the list
|
||||||
child.sendline('exit')
|
child.sendline('exit')
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user