pythonimport calendar
calendar.isleap(2024) # True
pythonimport calendar
calendar.prmonth(2023,2)
pythonimport calendar
# 返回该月首日星期和天数
calendar.monthrange(2023,2) # (2,28)
python# 输入:3 4 5
a, b, c = list(map(int, input().split()))
python# 无穷大
float('inf')
crontab命令是Unix和Linux用于设置周期性被执行的指令。该命令从标准输入设备读取指令,并将其存放于“crontab”文件中,以供之后读取和执行。crontab命令常见于 Unix 和 类Unix 的操作系统之中。通常,crontab储存的指令被守护进程激活, crond常常在后台运行,每一分钟检查是否有预定的作业需要执行。
该命令依赖于cron
,可通过下面命令安装和启用:
bash# 安装
sudo apt-get install cron
# 启动
systemctl start cron
# 查看状态
systemctl status cron
bash# 重新载入服务
systemctl daemon-reload
# 查看服务状态
systemctl status sshd
# 启动服务
systemctl start sshd
# 停止服务
systemctl stop sshd
# 重启服务
systemctl restart sshd
# 开机自启
systemctl enable sshd
# 取消开机自启
systemctl disable sshd