• 一个简单的Python3登入验证


     1 #coding:utf-8
     2 
     3 '''
     4 多级菜单
     5 1.广东省三级菜单
     6 2.可依次选择进入各子菜单
     7 3.所需新知识点:列表,字典
     8 4.输入B重选
     9 5.输入Q退出
    10 '''
    11 
    12 city = {"广东":{
    13             "广州":{
    14                  "天河":["五山","员村","车陂","沙河","石牌","兴华","沙东","林和","棠下"],
    15                  "黄埔":["萝岗街道","夏港街道","联和街道","东区街道","永和街道","黄埔街道"],
    16                  "越秀":["洪桥街道","北京街道","六榕街道","流花街道","光塔街道","人民街道","东山街道","农林街道"],
    17                  "番禺":["市桥街道","桥南街道","东环街道","沙头街道","洛浦街道","大石街道"]
    18                     },
    19             "深圳":{
    20                  "罗湖":["桂园街道","黄贝街道","东门街道","南湖街道","笋岗街道","东湖街道","莲塘街道","东晓街道","清水河街"],
    21                  "福田":["上步","福田环庆","岗厦","皇岗","水围","渔农","石厦","新洲","沙尾","沙嘴","上沙","下沙","上梅林","下梅林","田面"],
    22                  "南山":["南山街道","南头街道","西丽街道","沙河街道","蛇口街道","招商街道","粤海街道","桃源街道"],
    23                  "龙岗":["平湖","坂田","布吉","南湾","横岗","龙城","龙岗","坪地"],
    24                  "宝安":["新安街道","西乡街道","福永街道","沙井街道","松岗街道","石岩街道"]
    25                     }
    26             }
    27 
    28         }
    29 
    30 max_mark = "null"
    31 while max_mark == "null":
    32     for s in city.keys():
    33         print("
    ===========
    ")
    34         print("省份:")
    35         print(s)
    36 
    37     province = input("
    [Q]退出
    请选择以上的一个省:")
    38     if province == "Q":
    39         max_mark = "Q"
    40         break
    41     print("
    %s省所属市:"%province)
    42     for c in city[province].keys():
    43         print(c)
    44 
    45     municipality = input("
    [Q]退出,[B]返回上一级
    请选择以上的一个市:")
    46     if municipality == "Q":
    47         max_mark == "Q"
    48         break
    49     elif municipality == "B":
    50         continue
    51     print("
    %s省%s市所属区:"%(province,municipality))
    52     for q in city[province][municipality].keys():
    53         print(q)
    54 
    55     district = input("
    [Q]退出,[B]返回上一级
    请选择以上的一个区:")
    56     if district == "Q":
    57         max_mark == "Q"
    58         break
    59     elif district == "B":
    60         continue
    61     print("
    %s省%s市%s区所属村/镇/街道:"%(province,municipality,district))
    62     for j in city[province][municipality][district]:
    63         print(j)
  • 相关阅读:
    SpringBoot整合Apache-CXF实践
    jar包部署指定不同环境
    Cannot create GC thread. Out of system resources.
    更改"xxxx" 的权限: 不允许的操作
    [AWS] Lab: Configure a Cognito user can access DynamoDB for read
    [Tools] VI cmds
    [AWS DA GURU] KMS and Encryption on AWS
    [Linux] Add new sudo user & assign folder owner
    [AWS
    [AWS
  • 原文地址:https://www.cnblogs.com/l729414559/p/6755877.html
Copyright © 2020-2023  润新知