"Python road 21" User Login program function

Source: Internet
Author: User

First, the user login function instance

1, note: The function must be written later after the first line of functions to enter the "" "" "" "" two pairs of three quotation marks after the return, the parameter values are automatically listed, the function of the annotation functions, the use of parameters and return values

#!usr/bin/env python#-*-coding:utf-8-*-defLogIn (Username,password):"""reads the username and password of the login file for verification:p Aram Username: Incoming user name:p Aram Password: incoming password: return: True if username and password match, otherwise return false """With Open ('Login','R', encoding='Utf-8') as F: forLineinchF:line=line.strip () login= Line.split ('$')            ifUsername = = Login[0] andPassword = = Login[1]:                returnTruereturnFalsebol= LogIn ('TQG','111111')ifBol:Print('Landing Success')Else:    Print('Login Failed')

"Python road 21" User Login program function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.