用Python编写的列举所有对称日的小程序--菜鸟写的,请多指教,python小程序,[Python]代码li


[Python]代码

list=[] for i in range(1,13):    for j in range(1,32):        if i==2 and j>28:            break        elif  j>30 and (i==4 or i==6 or i==9 or i==11) :            break        else:            x=j%10*10+j/10            y=i%10*10+i/10            num=x*1000000+y*10000+i*100+j            list.append(num)list.append(92200229)list.sort()for k in range(0,len(list)):    year=list[k]/10000    month=list[k]%10000/100    day=list[k]%100    print "%04d"%year,"%02d"%month,"%02d"%day

评论关闭