问题描述
看起来应该很简单。
尝试:
Find
抓住我:
TypeError: res.status 不是函数
这是在工兵中,不确定这是否有所不同。
解决方法
根据 the docs,您使用 self
,或者如果您在中间件中抛出错误,您将使用 import random,copy
class cards:
chest_cards = (["Go to..."])
chance_cards = (["Go to Ja..."])
def __init__(self):
#before you over-write self.chest_cards,it refers to the class attribute
self.chest_cards = copy.copy(self.chest_cards) #make a local copy so you don't alter the master list
#after you over-write it,it will refer to the instance attribute as long as you made a copy.
#you can also refer to the class directly to access class-attributes
self.chest_cards = copy.copy(cards.chest_cards)
#if you want to get the class without calling it by name (in case you want to change the name of the class)
self.chest_cards = copy.copy(type(self).chest_cards)
random.shuffle(self.chest_cards)
。
具体做法如下:
res.writeHead(500,{'Content-Type': 'text/plain'})