Thank you for the reply.

 I created another variable named [ confirm_password ], and let it be compared in the if statement , and it worked just fine. But if i do this , user need to fill pw 2 times . If i want the user enter the pw only ONCE , and let the pw be compared to the pw information pull from the network device , what is need to be alter? This is the problem that i want to solve.  

from getpass import getpass

def get_input(prompt=''
try:
line = input(prompt)
except NameError:
line = input(prompt)
return line


def get_credentials_1():
"""Prompt for and return a username and password."""
username = get_input('Enter Username: ')
password = None
while not password:
password = getpass('Enter Password: ')
confirm_password = getpass('Confirm Password: ')
if password != confirm_password :
print('Passwords do not match. Try again.')
password = None
return username, password