できます。
Python
1while True:
2 try:
3 n = int(input('数字を入力:'))
4 break
5 except ValueError:
6 pass
7print(n)
ついでに2つの数字を入力する場合。
state = 0
while state < 2:
try:
if state < 1:
a = int(input('数字aを入力:'))
state = 1
elif state < 2:
b = int(input('数字bを入力:'))
state = 2
except ValueError:
print('error')
print(a, b)
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/07/02 07:13
2020/07/02 07:16
2020/07/02 07:27
2020/07/02 07:34
2020/07/02 08:11