|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
chinese = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
x = input('in:')
for times in range(len(x)):
x[times] = chinese[int(x[times])]
print(x)
Class 'str' does not define'_setitem_',so the '[]' operator cannnot be used on its instances:4
本帖最后由 jackz007 于 2022-6-5 14:36 编辑
- s = ''
- chinese = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
- x = input('输入数字:') . strip()
- if x and x . isdigit():
- for times in x:
- s += chinese[int(times)]
- print(s)
复制代码
- chinese = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
- x = input('输入数字:') . strip()
- if x and x . isdigit():
- e = list(range(len(x)))
- for times in range(len(x)):
- e[times] = chinese[int(x[times])]
- print('' . join(e))
复制代码
|
|