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