我在 python 中使用了一个随机函数,但它不起作用,我对 python 很陌生。请查看以下代码
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['number'] = random.randrange(1, 100)
return context
其重新调整错误 NameError: name 'random' is not defined