源码if.py
#!/usr/bin/python
# --*-- coding:utf-8 --*--
#input = raw_input('please input your name:')
while True:
input = raw_input('please input your name:')
if input == 'xwb':
password = raw_input('\nplease input your password:')
p = '123'
if password == p:
print 'welcome login to ddbill.com!\n'
break
else:
print '\nplease input password again!\n'
password = raw_input('\nplease input your password:')
while True:
print '\nplease input password again!\n'
password = raw_input('\nplease input your password:')
if password == p:
print 'welcome login to ddbill.com!\n'
break
break
else: print 'sorry user %s not found'% input
运行:
root@kali:~# vim if.py
root@kali:~# python if.py
please input your name:ww
sorry user ww not found
please input your name:xwb
please input your password:e3243
please input password again!
please input your password:ewewr
please input password again!
please input your password:123
welcome login to ddbill.com!