下面是自己琢磨的代码,感觉太臃肿又找不到简单的方法,很笨,最多到5位数,而且打印出来还是多行,不会一行输出,删除多余的字,有大佬指点一下吗? 论坛也是刚刚玩,不会把代码写到框框里。哪位大佬有空的话还望不吝指点,多谢。 x = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] y = ['圆', '拾', '佰', '仟', '萬'] k = input('请输入:') for i in x: if int(len(k)) == 5: print( x[int(k[0])] + y[int(len(k) - 1)] + x[int(k[1])] + y[int(len(k) - 2)] + x[int(k[2])] + y[int(len(k) - 3)] + x[int(k[3])] + y[int(len(k) - 4)] + x[int(k[4])], end='') elif int(len(k)) == 4: print(x[int(k[0])] + y[int(len(k) - 1)] + x[int(k[1])] + y[int(len(k) - 2)] + x[int(k[2])] + y[ int(len(k) - 3)] + x[int(k[3])], end='') elif int(len(k)) == 3: print(x[int(k[0])] + y[int(len(k) - 1)] + x[int(k[1])] + y[int(len(k) - 2)] + x[int(k[2])], end='') elif int(len(k)) == 2: print(x[int(k[0])] + y[int(len(k) - 1)] + x[int(k[1])], end='') elif int(len(k)) == 1: print(x[int(k[0])]) else: print('输入有误') print('圆整')