password special character $ is not taking taking by argparser

Discussion in 'Python' started by sujan.dasmahapatra, Aug 26, 2013.

  1. sujan.dasmahapatra

    sujan.dasmahapatra Member

    Joined:
    Jun 11, 2009
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Gender:
    Male
    I am trying to enter user name and password from command line. user name is 'rohit2010@gmail.com' and password is 'Lemon$319'.....When I am printing this values I can see the password is wrong. I am typing Lemon$319 but it is printing 'Lemon19'. $ and 3 are discarded.....Please help me what is going wrong.why it is not taking special character $?....Most of my passwords are having '$' sign. Please help.
    Code:
    __author__ = 'sujan'
    #!/usr/bin/python
    
    import argparse
    import sys
    
    def main(argv):
        parser = argparse.ArgumentParser(description='Description of your program')
        parser.add_argument('-u', '--usr', help='UserName', required=True)
        parser.add_argument('-p', '--pswd',help='PassWord', required=True)
        args = vars(parser.parse_args())
        uname = args['usr']
        # code here
    
        password =  args['pswd']
        # code here
    
        if uname is None or password is None:
            print "User name - Password not valid"
        else:
            print uname
            print password
            print "calling program"
    
    if __name__ == "__main__":
       main(sys.argv[1:])
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice