python3代码示例1

    技术2022-05-18  13

    #coding=utf-8

    import sys

    const_g_MaxLen = 7

    Zero = ["0",        "0",     "0",     "0",     "0",     "0",     "0"]  One = ["11",       "11",    "11",    "11",    "11",    "11",    "11"]    Two = ["222",    "222",    "222",    "222",    "222",    "222",    "222"]    Three = ["3333",         "3333",      "3333",      "3333",      "3333",      "3333",      "3333"]   Four = ["4444",        "4444",     "4444",     "4444",     "4444",     "4444",     "4444"]  Five = ["55555",        "55555",     "55555",     "55555",     "55555",     "55555",     "55555"]  Six = ["666666",       "666666",    "666666",    "666666",    "666666",    "666666",    "666666"]    Seven = ["777777",         "777777",      "777777",      "777777",      "777777",      "777777",      "777777"]   Eight = ["88888888",         "88888888",      "88888888",      "88888888",      "88888888",      "88888888",      "88888888"]   Nine = ["9999999999",        "9999999999",     "9999999999",     "9999999999",     "9999999999",     "9999999999",     "9999999999"]  Digits = [Zero,One,Two,Three,Four,Five,Six,Seven,Eight,Nine]

    try: input_digits = str(sys.argv[1]) #输入的数字 #print("input_digits = %s" %input_digits)  input_len = len(input_digits) #输入的数字长度 #print("input_len = %s" %input_len)  for row_index in range(const_g_MaxLen):  one_row = ""  for col_index in range(input_len):   number_content = input_digits[col_index] #输入的数字   #print("number_content = %s" %number_content)      str_number_content = Digits[int(number_content)]#对应的字符串   #print(str_number_content)      one_col = ""   one_col = str_number_content[row_index]   #print(one_col)      one_row += one_col     print(one_row)    except Exception as err: print("Enter an exception.") print("type(err) = %s" %type(err)) print("err = %s" %err) 


    最新回复(0)