The application and tertiary menu of python Xiaobai's growth diary day 3 .

Ps: I don't like English since I was a child. I went around and around to programming, and I still can't do without English 5555~~
name= 'hanbinlong \t is {name} and i an {year}'
 print (name.capitalize()) #capitalize the first letter
 print (name.count( 'n' ) ) #how many n in the string
 print ( name.center( 50 , '-' ) ) #Total 50 characters, put the string in the middle and the rest -
 print (name.encode() ) #Convert the string to binary
 print (name.endswith( 'd ' ) ) # Determine whether it ends with ''
 print (name.expandtabs( tabsize = 30 ) ) #Convert \t into thirty spaces
 print (name.find( 'is' ) ) #Find the first character of is (think of is as a whole) index
#find can also slice print(name[(name.find('is')):20]) to slice 'is' to the twentieth character
 print (name.format( name = 'hanbinlong' , year = ' 21' ) ) #Can be formatted
 print (name.format_map({ 'name' : 'hanbinlong' , 'year' : '21' }) ) #The answer is the same as above
 print (name.index( 'an' )) #See the first The number of a letter is
 #print('hhh'.isalnum() )#The judgment contains no numbers but no special characters. Note that the judgment is. The previous
 print ( ' hhh'.isalpha()) #Judgment whether it is Note that pure English characters are judged. The previous
 print ( '33.33' .#Judgment can only have numbers. The previous
 print ( 'name' .isidentifier) ​​#Judging whether it is a legal identifier
 print ( 'Name' .islower() ) #Judging whether it is only lowercase
 print ( '33.33' .isnumeric( ) ) #Determine whether there can only be numbers
 print ( 'name' .isspace() ) # Determine whether it is a space
 print ( 'My name is' .istitle() ) # Determine whether the first letter of each letter is uppercase
 print ( 'Name' .isupper() ) #Determine whether it is only uppercase
 print ( '' .join([ '1' , '2' , '3']) ) #Note: '' must be added to [] in python2.x ==>123
# If the previous '' becomes ', '==>1,2,3 If the previous '+' ==>1+2+3
 print (name.ljust( 50 , '*' ) ) #Total length 50 If it is not enough, use * to make
 up print (name.rjust( 50 , '-' ) ) #Total length 50 is not enough to use - fill in front
 print ( 'Name' .lower() ) #Change uppercase to lowercase
 print ( ' name'.upper () ) #Change lowercase to uppercase
 print ( ' \n name' .lstrip() ) #Remove spaces and carriage returns on the left
 print ( 'name \n ' .rstrip() ) #Take spaces and carriage returns on the right
 print ( ' \n name\n ' .strip() ) #Remove left and right spaces and carriage returns
 p= str .maketrans( 'abcdefg' , '1234567' )
 print ( 'hanbinlong' .translate(p) ) #Let abcdefg be equal to 1234567 respectively
 #Then let 'hanbinlong' corresponds to the relative numbers or letters =="h1n2inlon7
 print ( 'hanbinlong hahaha' .replace( 'h' , 'H' ) ) #Replace h with
 H #If you only want to replace one.replace( 'h','H',1)
 print ( 'hanbinlong' .rfind( 'in' ) ) #Count the rightmost coordinates from left to right
 print ( 'han bin long' .split() ) #divide into a sequence with spaces as the boundary
#If you want to use other as the boundary.sqlit('a')
 print ( 'hanbin \n long' .splitlines() ) #divide into an array with /n as the boundary
 print ( 'han bin long' .startswith( 'l' ) ) #Determine whether the first letter is a letter in ''
 print ( 'han bin long' .swapcase() ) #Uppercase to lowercase and lowercase to uppercase
 print ( 'han bin long' .title() ) #The first letter is capitalized
__author__ = 'Ask peace'
 __author__ = 'Ask peace '
 data = {
     'Beijing' :{
             "Changping" :{
             "Shahe" :[ "oldboy" , "test" ],
             "Tiantongyuan" : [ "Lianjia Real Estate" , "I love my house" ]
        },
        "Chaoyang" :{
             "Wangjing" :[ "Benz" , "Momo" ],
             "Guomao" :{ "CICC" , "HP" },
             "Dongzhimen" :{ "Advent" , "Fetion" },
        },
        "Haidian" :{},
    },
    'Shandong' :{
         "Dezhou" :{},
         "Qingdao" :{},
         "Jinan" :{}
    },
    'Guangdong' :{
         "Dongguan" :{},
         "Changshu" :{},
         "Foshan" :{},
    }
}
while True:
    for i in data:
        print(i)
    choose= input ( 'Please choose to enter 1 list=="' )
     if choose in data :
         while True :
                 for i2 in data[choose]:
                     print (i2)
                choose2= input ( 'Please choose to enter 2 list=="' )
                 if choose2 in data[choose] :
                          while True :
                             for i3 in data[choose][choose2]:
                                 print (i3)
                            choose3= input ( 'Please choose to enter the 3 list=="' )
                             if choose3 in data[choose][choose2 ] :
                                 while True :
                                     for i4 in data[choose][choose2][choose3 ]:
                                         print (i4)
                                    choose4= input ( 'The last layer, press b to return and press q to exit' )
                                     if choose4== 'b' :
                                         break
                                     elif choose4== 'q' :
                                         exit ()

                            if choose3=='b':
                                break
                            elif choose3=='q':
                                 exit()
                if choose2=='b':
                    break
                elif choose2=='q':
                     exit()
    if choose=='b':
        break
    elif choose=='q':
        exit()


Back words! ! ! ! ! ! ! ! ! ! !

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325817925&siteId=291194637