请8友看看我的问题发生在了哪里?输入身份证号后显示int object is not subscriptable

img


请8友看看我的问题发生在了哪里?输入身份证号后显示int object is not subscriptable

改成这样:

a = input('请输入身份证号码:')
Age = int(a[7:11]) + 2019
print('今年的年龄是{}岁'.format(Age))

你现在的类型为int整数类型,应转换成字符串类型