diff options
| author | Steven Myint <git@stevenmyint.com> | 2013-10-08 19:46:16 -0700 |
|---|---|---|
| committer | Steven Myint <git@stevenmyint.com> | 2013-10-08 19:46:16 -0700 |
| commit | a34cfbdde75d8d0aa276afeeb824522fe82a7b34 (patch) | |
| tree | e1d41ea40131dcc927906b67cdcf4cbc6a156688 /examples/ftp.py | |
| parent | 1141915a17bd446d330de0c8fe3a017ebc6b2e06 (diff) | |
| download | pexpect-a34cfbdde75d8d0aa276afeeb824522fe82a7b34.tar.gz | |
Add note about unicode_literals and spawnu
Diffstat (limited to 'examples/ftp.py')
| -rwxr-xr-x | examples/ftp.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/ftp.py b/examples/ftp.py index 678d032..a1c1343 100755 --- a/examples/ftp.py +++ b/examples/ftp.py @@ -31,7 +31,11 @@ from __future__ import unicode_literals import pexpect import sys +# Note that, for Python 3 compatibility reasons, we are using spawnu and +# importing unicode_literals (above). spawnu accepts Unicode input and +# unicode_literals makes all string literals in this script Unicode by default. child = pexpect.spawnu('ftp ftp.openbsd.org') + child.expect('(?i)name .*: ') child.sendline('anonymous') child.expect('(?i)password') |
