Python指令碼 基礎指令碼訓練
阿新 • • 發佈:2019-02-18
#!/usr/bin/env python
def doubleCheckInput(input1,input2="Jimmy"):
if input1 == input2:
print "The password is right!"
print "Value of input2:%s" % input2
return 1
else:
print "Pls check the passwork and enter again."
return 0
def changeThePwd(input1,input2):
if input1 == input2:
print "The pwd setup successfully"
return 1
else:
print "Error:Pls check the enter and enter again!"
return 0
if __name__ == '__main__':
oldPwd1 = raw_input("Pls enter the PWD:")
reslove = doubleCheckInput(oldPwd1)
if reslove == 1:
newPwd1 = raw_input("Pls enter the new PWD:")
newPwd2 = raw_input("Pls enter the new PWD again:")
changePwdReslove = changeThePwd(newPwd1,newPwd2)
if changePwdReslove == 1:
print "Change Done"
else:print "Error:Change Failed"
else:
print "The PWD is worng"
print "Done"
def doubleCheckInput(input1,input2="Jimmy"):
if input1 == input2:
print "The password is right!"
print "Value of input2:%s" % input2
return 1
else:
print "Pls check the passwork and enter again."
return 0
def changeThePwd(input1,input2):
if input1 == input2:
print "The pwd setup successfully"
return 1
else:
print "Error:Pls check the enter and enter again!"
return 0
if __name__ == '__main__':
oldPwd1 = raw_input("Pls enter the PWD:")
reslove = doubleCheckInput(oldPwd1)
if reslove == 1:
newPwd1 = raw_input("Pls enter the new PWD:")
newPwd2 = raw_input("Pls enter the new PWD again:")
changePwdReslove = changeThePwd(newPwd1,newPwd2)
if changePwdReslove == 1:
print "Change Done"
else:print "Error:Change Failed"
else:
print "The PWD is worng"
print "Done"