1 # !/usr/bin/env python 2 # -*- coding:utf-8 -*- 3 # Author:lzd 4 5 # 创建字典tmpuser 6 tmpuser = dict() 7 tmpuser[0] =['江苏省','南京市','建邺区'] 8 tmpuser[1] =['江苏省','南京市','玄武区'] 9 tmpuser[2] =['江苏省','南京市','雨花区'] 10 tmpuser[3] =['江苏省','南京市','白下区'] 11 tmpuser[4] =['江苏省','扬州市','下关区'] 12 tmpuser[5] =['福建省','三明市','三元区'] 13 tmpuser[6] =['福建省','三明市','梅列区'] 14 tmpuser[7] =['安徽省','合肥市','姚水区'] 15 tmpuser[8] =['安徽省','淮南市','谢家集区'] 16 tmpuser[9] =['浙江省','杭州市','西湖区'] 17 tmpuser[10] =['浙江省','杭州市','滨江区'] 18 19 flag=True 20 flag2=True 21 while flag2: 22 while flag: 23 i=0 24 while i<11: 25 print(str(i)+tmpuser[i][0]+' ') 26 i=i+1 27 shengfen=int(input('请选择一个省份?')) 28 j=0 29 while j<11: 30 if shengfen==j: 31 k=0 32 while k<11: 33 if tmpuser[k][0]==tmpuser[shengfen][0]: 34 print(str(k)+tmpuser[k][1]+' ') 35 k=k+1 36 j=j+1 37 38 shiqu=int(input('请选择一个市区?返回选择省份按88')) 39 if shiqu==88: 40 flag=True 41 continue 42 flag=False 43 m=0 44 while m < 11: 45 if tmpuser[m][0]==tmpuser[shengfen][0] and tmpuser[m][1]==tmpuser[shiqu][1]: 46 print(tmpuser[m][2]+' ') 47 m=m+1 48 quyu=int(input('返回选择选择省份按88,结束按99')) 49 if quyu==88: 50 flag=True 51 flag2=True 52 continue 53 elif quyu==99: 54 flag2=False