[Tutor] Datetime object as a class property

John Weller john at johnweller.co.uk
Mon Aug 31 11:39:35 EDT 2020


I have an instance of a class called, say, data.  I know I can create a
property, name, in the class as a string with self.name = '' which I can
then populate in an instance of my class with data.name = 'John'.  How do I
create datetime object, eg sunrise, so that in the code I can put
data.sunrise = datetime.strptime("05:45:00", "%H:%M:%S").  Self.sunrise = ?

 

Thanks

 

John

 

John Weller

01380 723235

07976 393631

 



More information about the Tutor mailing list