3
AttributeError: โมดูล 'datetime' ไม่มีแอตทริบิวต์ 'strptime'
นี่คือTransactionชั้นเรียนของฉัน: class Transaction(object): def __init__(self, company, num, price, date, is_buy): self.company = company self.num = num self.price = price self.date = datetime.strptime(date, "%Y-%m-%d") self.is_buy = is_buy และเมื่อฉันพยายามเรียกใช้dateฟังก์ชัน: tr = Transaction('AAPL', 600, '2013-10-25') print tr.date ฉันได้รับข้อผิดพลาดต่อไปนี้: self.date = datetime.strptime(self.d, "%Y-%m-%d") AttributeError: 'module' object has no attribute 'strptime' ฉันจะแก้ไขได้อย่างไร
154
python
class
python-2.7