Python Learning Day1 Landing

Source: Internet
Author: User

#/usr/bin/env Python3
#coding: Utf-8

Import OS
Import Sys
Import Getpass
Import JSON

Storage_user_file = "./"
Correct_user = "KK"
Correct_pass = "KK"

For I in range (3):
Existing_users_dict = json.load (open (Storage_user_file, ' R '))
Get_user = input ("Please your username")
Get_pass = input ("Please your password")
if Correct_user = = Get_user and Correct_pass = = Get_pass:
Print ("Welcome to login..")
If Get_user in Existing_users_dict:
If Existing_users_dict[get_user] >= 3:
Print ("You are locked")
Json.dump (Existing_users_dict,open (Storage_user_file, "w"))
Print ("The user name or password entered is incorrect.")
Existing_users_dict[get_user] = 1
Json.dump (Existing_users_dict,open (Storage_user_file, "w"))
Print ("The user name or password entered is incorrect.")

Python Learning Day1 Landing

Related Article

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: 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.