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.
给定一个ntimedelta 对象列表,时间的最小单位是分钟,
n
from datetime import timedelta as td [td(days=1, hours=4, minutes=0), td(days=0, hours=2 minutes=30), td(days=3, hours=0 minutes=30), ...]
我怎样才能找到最小的公倍数?
您可以将其全部转换为秒并获得 LCM。利用timedelta.total_seconds()
timedelta.total_seconds()
https://docs.python.org/2/library/datetime.html