Skip to main content
 首页 » 编程设计

Python 箭头添加小时/分钟/等 vs 替换

2025年05月04日11linjiqin

<分区>

我想在 Python 中使用 arrow 与 datetime,我想将以下示例转换为 arrow:

end_date = start_date + timedelta(days=5) 

我在 arrow 文档中看到的唯一内容是:

start_date.replace(weeks=+3) 

但我想分配 end_date 比 start_date 多 5 天 - 不更改现有的 start_date

我不想写,即:

end_date = start_date 
end_date.replace(days=+5) 

我想在单行中完成...有什么想法吗?