这是我的班级酒吧:
class Bar:
def __init__(self, start, end, open, volume, high=open, low=open, last=open):
self.start = start
self.end = end
self.open = open
self.high = high
self.low = low
self.last = last
self.volume = int(volume)
def __str__(self):
return self.start.strftime("%m/%d/%Y\t%H:%M:%S") + "\t" + self.end.strftime("%H:%M:%S") + "\t" +str(self.open) + "\t" + str(self.high) + "\t" + str(self.low) + "\t" + str(self.last) + "\t" + str(self.volume)
1)我正在尝试初始化高、低和最后的开盘价。这是正确的方法吗?
2)当我做 print(str(bar)) 我得到有趣的输出,比如......
03/13/2012 12:30:00 13:30:00 138.91 <built-in function open> 138.7 <built-in function open> 13177656