def text_index(string,index):
print(string[index])
str_x = ''
num = 0
try:
str_x = pass
num = pass
text_index(str_x,num)
str_x + num
except:
pass
else:
pass
finally:
pass
def text_index(string,index):
print(string[index])
str_x = ''
num = 0
try:
str_x = input()
num = int(input())
text_index(str_x,num)
str_x + num
except Exception as e:
print(repr(e))
主要是这几句,测试的时候依次下面三种输入,都会报错
abc
a
ValueError("invalid literal for int() with base 10: 'a'")
abc
3
IndexError('string index out of range')
abc
2
c
TypeError('can only concatenate str (not "int") to str')