Username and password using expect in python
Question: write a piece of code that ask the user to set a password \- queries the user
for his/her user name \- queries the user for his/her password twice, making
sure the user enters the same password twice \- Allow Only 3 attempts to get a
correct password

the rules for the password are \- at least one number \- at least one lower
cap letter \- at least one upper cap letter \- allowed characters: numbers,
letters, "_", "-" and "."

The above task should be done using expect concept. Since am new to python
language can anyone help me in solving this task.

    
    
              import pexpect
              child = pexpect.spawn('ftp ftp.openbsd.org')
              child.expect('Name .*: ')
              child.sendline('anonymous')
              child.expect('Password:')
    

I have tried till thid and donn't know how to proceed.


Answer: How about

    
    
    child.sendline(raw_input('Password:'))
    

It prints `Password:` and asks the user for the password.

