Get the App
SLTechnology News&Howtos  ›  Servers  › 

Python Mini script 1

Shulou Source: shulou.com Published: 2022-06-02 07:04:08 09月22日 Update

#! / usr/bin/python

#-*-coding: UTF-8-*-

Def account_login (account):

If account in Dict.keys ():

Tmp=Dict [account]

Password=input ("enter the password:")

If password in tmp.keys ():

If tmp [password] = = 0:

Return 0

Else:

Return 3

Else:

Print ('Error password:')

Return 1

Else:

Return 2

Def lock_account (account):

For k in Dict:

If k = = account:

For subk in Dict [k]:

Dict [k] [subk] = 1

Def try_times (account):

Num=3

While num > 0:

Result=account_login (account)

If result = = 1:

Num=num-1

If num = = 0:

Lock_account (account)

Print ('The account% s is locked current% account)

Exit ()

Elif result = = 2:

Print ('no account')

Exit ()

Elif result = = 3:

Print ('The account was locked')

Exit ()

Elif result = = 0:

Print ('success login on the% slots% account)

Break

List1 = []

List2 = []

Def check_intnumber (n):

If int (n)% 2 = = 0:

Return True

Else:

Return False

Def append_list (arg_list):

Global list1

Global list2

For i in arg_list:

If check_intnumber (I) = = True:

List1.append (I)

Elif check_intnumber (I) = = False:

List2.append (I)

Def filit_number (arg):

Arg_list = arg.split (',')

For i in arg_list:

If str.isdigit (I) = = False:

Arg_list.remove (I)

Else:

Pass

Return arg_list

Def main ():

Account=input ("enter the accout:")

Try_times (account)

Arg = input ('enter someting to check:')

Arg_list = filit_number (arg)

Append_list (arg_list)

Print ('odd number',list2)

Print ('even number',list1)

If _ _ name__ = ='_ _ main__':

Dict = {'oracle': {' a123: 0}, 'root': {' b123: 0}, 'mysql': {' c123: 1}}

Main ()

# # A novice test requires user verification before performing functions. 0 in the user dictionary means normal and 1 means the user is locked.

Tags: User pilot function Dictionary novice UTF-8 Authentication script Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MySQL NVidia Shulou Technology Xiaomi