I have a 2d list and a class to get users input for row and column and retrieve that object but if that row/column doesn't exist it says that list out of index but i want it return saying error
this is my current code
return self.object[row][column]
try:
return self.object[row][column]
except IndexError:
return "error"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.