我正在尝试学习 Python,但我陷入了日期/时间例程中,我需要查找 05:00 到 11:30 之间发生的数据,但无论我如何处理,我都会遇到错误。我认为我需要解码时间,进行数学运算,然后对时间进行编码。我确信这是一件简单的事情,但我似乎无法完成它。
例子:
riders = [
["rider_2391", 37_775370, -122.417571, 37_808601, -122.409807, "17:02:35", "$17.23", "UberX"],
["rider_1879", 37.775222, 122.47109, 37.808080, -122.410002, "06:25:08", "$22.25", "UberX"],
["rider_98233", 37.784125, -122.471891, 37.763025, 122.478749, "11:48:55", "$6.28", "Pool"]
]
def getRiderDate(riders):
ans = []
for rider in riders:
if rider[5] >= "05:00:00" and rider[5] <= "11:30:00":
ans.insert(len(ans), rider)
return ans
print(getRiderDate(riders)
慕盖茨4494581
蝴蝶刀刀
相关分类