我有一个代码,可以告诉天气在输入的位置。 我想做一个选项来打印未来3天的天气,我需要向我的功能发送3个日期(带循环),每次不同的日期,我如何才能从当天发送未来3天的日期?你知道吗
#This is my function
def weather(city, date):
#This is the part where I send it from the main to the function:
city = 'Paris'
while(i < 4):
i += 1
weather(city.lower(), dd/mm/yyyy)# Here instead of "dd/mm/yyyy" I need to send every time the next date from today.
生成日期范围的最简单方法是使用
pandas.date_range
作为或者您可能会坚持在接下来的几天使用循环,您可以使用
datetime.timedelta
使用
datetime.timedelta(days=1)
将您的一天增加1,如下所示,您可以将此日期传递给函数相关问题 更多 >
编程相关推荐