#!/usr/bin/env python # coding: utf-8 # In[1]: get_ipython().run_line_magic('matplotlib', 'inline') import numpy as np import matplotlib.pyplot as plt # In[2]: st = '20200202' st == st[::-1] # In[3]: days = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # In[6]: '3'.zfill(2) # In[8]: def palindrome(st): return st==st[::-1] # In[14]: for year in range(100): sty = str(2000+year) for m in range(1, 13): stm = sty + str(m).zfill(2) for d in range(1, days[m-1]+1): std = stm + str(d).zfill(2) if palindrome(std): print(std, '是回文日!') # In[13]: st # In[ ]: