11 2021 档案

摘要:import datetime class TimeException(Exception): def __init__(self, exception_info): super().__init__() self.info = exception_info def __str__(self): r 阅读全文
posted @ 2021-11-24 16:19 wanghhhh 阅读(60) 评论(0) 推荐(0)
摘要:1.计算列表中有sex = f个字典的数量 list = [{'name':'Mike', 'sex':'m'}, {'name':'Rose', 'sex':'f'}] count = (p['sex'] == 'f' for p in list) print(sum(count)) 阅读全文
posted @ 2021-11-23 20:41 wanghhhh 阅读(56) 评论(0) 推荐(0)
摘要:需要 只保留/data/下最新的3个文件 ls -t /data/* |awk 'NR>=3' |xargs rm -rf 脚本 #!/bin/bashpath="/data/backups/file/target" cd $path dir_name=`ls` for dir in ${dir_n 阅读全文
posted @ 2021-11-22 10:04 wanghhhh 阅读(415) 评论(0) 推荐(0)