Python-100-Days/Day31-35/code/dayofyear.py

22 lines
416 B
Python
Raw Normal View History

2018-07-22 23:49:55 +08:00
import sys
import mycal
def main():
if len(sys.argv) != 4:
print('Not enough arguments')
return
year = int(sys.argv[1])
month = int(sys.argv[2])
day = int(sys.argv[3])
total = 0
for m in range(1, month):
total += mycal.get_days(year, m)
total += day
print(f'{year}{month}{day}日是{year}年的第{total}')
if __name__ == '__main__':
main()