- 积分
- 1626
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-1-5
- 最后登录
- 1970-1-1
|
发表于 2018-5-21 09:59:50
|
显示全部楼层
import time
fn= 'F:/cmorph/2008/SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-%s.GRD'
import time
starttime = '2008-1-1 0:00:00'
endtime ='2008-1-12 0:00:00'
#先转换为时间数组,然后转换为其他格式
timeStruct = time.strptime(starttime , '%Y-%m-%d %H:%M:%S')
starttimeStamp = int(time.mktime(timeStruct))
timeStruct = time.strptime(endtime , '%Y-%m-%d %H:%M:%S')
endtimeStamp = int(time.mktime(timeStruct))
while starttimeStamp<=endtimeStamp:
for i in arange(0,23):
starttimeStamp =starttimeStamp + 3600
localTime = time.localtime(starttimeStamp)
strTime = time.strftime('%Y%m%d%H', localTime)
fn%strTime
print(fn%strTime) |
|