import datetime count = 0 for y in range(1901,2001): for m in range(1,13): if datetime.datetime(y,m,1).weekday() == 6: count += 1 print count datetime此功能很好用.省去了计算的麻烦. count = 0 days = 1 year = 365 normal = [31,28,31,30,31,30,31,31,30,31,30,31] leap =…