def changes(number):
numbers = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
if number in range(len(numbers)):
return numbers[number]
lists = []
for i in range(10):
demo = input('请输入列表第{0}个值:'.format(changes(i)))
lists.append(demo)
print(lists)
def changes(number):
numbers = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
if number in range(len(numbers)):
return numbers[number]
lists = []
for i in range(10):
demo = input('请输入列表第{0}个值(输入空格或者回车可以跳出本次操作!):'.format(changes(i)))
if demo.strip() =='':
break
lists.append(demo)
print(lists)
changes(param) 是一个简单的替换阿拉伯数字函数,当然这种写法很多!