#多用户登录
Import getpass #引用getpassimport os #引用osimport configparser #引用配置文件操作的库count = 0count_other = 0whi Le true:if os.path.exists ('./user.conf '): #判断user. conf whether the user exists user_name = input (" Please input your username: ") #输入用户名 User_pass = getpass.getpass (" Please input your password: ") #输入密码 CP = Configparser. Configparser () # Load an existing profile Cp.read ("./user.conf") Li = Cp.get (' user ', ' user '). Split (', ') #将用户名放入列表li中 if user_name in Li: #判断用户是否在列表中 password = cp.get (user_name, ' password ') St atus = Int (cp.get (user_name, ' status ')) if password = = user_pass:if Status = = 3: Print ("Your username is locked! Your administrator ") Break else: Print ("Welcome to my system!!!") Break Else:print ("You input the username or password are wrong, please try agin!!") status = Int (status) + 1 Cp.set (user_name, ' status ', str (status)) with open (' user.conf ') , ' W ') as Fw:cp.write (fw) If status = = 3:print ("Your username is lo cked! Your administrator ") Break Else:print (" You input the username or pas Sword is wrong, try agin!! ") Count_other = count_other + 1 if Count_other = = 3:break Continue Else:co NF = configparser. Configparser () # write config file conf.add_section (' user ') #添加section # Add Value conf.set (' User ', ' user ', ' Ji MMY,AAA,BBB ') conf.add_section (' Jimmy ') Conf.set (' Jimmy ', ' Password ', ' AAA ') Conf.set (' Jimmy ', ' Statu S ',' 0 ') conf.add_section (' AAA ') conf.set (' AAA ', ' Password ', ' AAA ') conf.set (' AAA ', ' status ', ' 0 ') Conf.add_section (' BBB ') conf.set (' BBB ', ' Password ', ' BBB ') conf.set (' BBB ', ' status ', ' 0 ') # Write file With open ('./user.conf ', ' W ') as Fw:conf.write (FW)
What type of language is Python:
Compiled language, the code before the implementation of the plaintext, first turn to binary, in the execution, the process is called compiling; (C,c++,go)
Features: High operating efficiency; Depending on the build platform, the Linux operating system interacts with the CPU with Windows not exactly the same (e.g. Linux:print_to_console,windos:print_to_screen);
Cons: No cross-platform, low development efficiency
Python full stack development 13th day