目录结构
代码
import os
import datetime
name_list = [
'赵嘉豪', '巩景云', '李琦', '潘立府', '胡凯琴', '雷俊', '刘闯', '毛毅智', '葛林丽', '朱缘应', '雷鸣',
'赵刚', '吴锡', '张岩', '高化焱', '孔凡平', '王强', '杨文益', '伍开日', '朱竹平', '周瑞星', '许长义',
'储皖浏', '徐浩', '吴奇宇', '张天承', '赵志强', '朱健', '魏义军', '曹降祥', '陈跃春', '黄云', '段力钢',
'刘金', '朱子超 ', '陈宇超'
]
def check_homework(day):
filename_list = os.listdir(day)
new_name_list = []
for filename in filename_list:
if filename.endswith('md'):
new_name_list.append(filename.replace('.md', ''))
s = ''
for name in name_list:
if name not in new_name_list:
s += f'{name}|'
day_time = str(datetime.datetime.now()).split(' ')[0]
check_filename = os.path.join(day, f'{day_time}-py9博客情况汇总.txt')
with open(check_filename, 'w', encoding='utf8') as fw:
fw.write(s)
return s
if __name__ == '__main__':
s = check_homework('0516')
print(s)