crontab_time={'minute': '1', 'hour': '', 'day_of_week': '5', 'day_of_month': '', 'month_of_year': '*',}
for k in list(crontab_time.keys()):
? ? if not crontab_time[k]:
? ? ? ? del crontab_time[k]
print(crontab_time)
輸出: {'minute': '1', 'day_of_week': '5', 'month_of_year': '*'}