这是我的代码:
class AstockTrading(object):
def _init_(self, strategy_name, period):
self._strategy_name = strategy_name
self._period = period
def strategy(self):
self._period = None
# instance
a1 = AstockTrading('ma', 20)
a1._period
这是控制台:
a1 = AstockTrading('ma', 20)
Traceback (most recent call last):
File "<ipython-input-86-14c313ab3ec4>", line 1, in <module>
a1 = AstockTrading('ma', 20)
TypeError: AstockTrading() takes no arguments