Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
datetime.datetimeオブジェクトがあります。私がやりたいのは、データを取り出してリストに入れることだけです。私が見つけた唯一の方法は次のとおりです。
date_list=list(my_dt_ob.timetuple())
これは、概念的に単純なことを行うための非常に複雑な方法のようです。誰かもっと良い方法がありますか?ありがとう。
日付と時刻の各部分は、datetimeオブジェクトの属性として使用できます。それらを直接使用できます。
datetime
date_list = [my_dt_ob.year, my_dt_ob.month, my_dt_ob.day, my_dt_ob.hour, my_dt_ob.minute, my_dt_ob.second]