Colab 在执行 input() 函数(Python)后意外卡住并挂起,例如:input(“你叫什么名字?”)。查看附件。我正在使用 Colab 免费版本。 请指教,可以做什么?预先感谢!
Google Colab 卡住并挂起后,唯一要做的就是中断执行并重新运行单元
我也有同样的问题。看起来,它被困在之前的执行中(我确信,即使在那时代码中也没有错误)。所以我尝试用 str(input..) 重写 int(input..) ,错误保持不变 'TypeError: 'int' object is not callable'.
*
input = str(input('Enter a number: '))
try:
print(input)
except ValueError:
print('Enter a number!')
except TypeError:
print('Something went wrong, Type Error.')
except:
print('Something went wrong, general')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-23-8d212bccaba9> in <cell line: 1>()
----> 1 input = str(input('Enter a number: '))
2
3 try:
4 print(input)
5 except ValueError:
TypeError: 'int' object is not callable
PS:抱歉,我将其作为答案发布,太长了,无法发表评论。