You almost have it. You just need to straighten out a few details. First, if the input fails, you want an empty input:
try:
move = [int(s) for s in input("Select a cell (row,col) > ").split(",")]
except:
move = []
Now you want to repeat the input until it is valid. You first need the syntax for a while loop:
while <condition>:
<body>
Where condition
evaluates to a boolean and <body>
is the lines to repeat. In this case, you want to repeat the try...except
.
def main():
while move != []:
try:
move = [int(s) for s in input("Select a cell (row,col) > ").split(",")]
except:
move = []
x = move[0]
y = move[1]
When you get stuck on syntax issues like this, I suggest you read the documentation and tutorials at https://python.org. They explain how to correctly write a while loop or try...except and more.