Skip to content

Commit

Permalink
fix: py
Browse files Browse the repository at this point in the history
  • Loading branch information
DrAugus committed Jan 9, 2024
1 parent be95c88 commit c2da61b
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
4 changes: 4 additions & 0 deletions 2024/01/08.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 2024/01/08

公司真的是一个很好的公司,但是团队的价值观好极端。公司的各个福利都非常不错,各个团队之间的差距真的大。

45 changes: 45 additions & 0 deletions 2024/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 2024

## Jan

|Sun|Mon|Tue|Wed|Thu|Fri|Sat|
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| |01|02|03|04|05|06|
|07|[08][2024/01/08]|[09][2024/01/09]|10|11|12|13|
|14|15|16|17|18|19|20|
|21|22|23|24|25|26|27|
|28|29|30|31| | | |



[2024/01/01]: https://draugus.github.io/diary/2024/01/01
[2024/01/02]: https://draugus.github.io/diary/2024/01/02
[2024/01/03]: https://draugus.github.io/diary/2024/01/03
[2024/01/04]: https://draugus.github.io/diary/2024/01/04
[2024/01/05]: https://draugus.github.io/diary/2024/01/05
[2024/01/06]: https://draugus.github.io/diary/2024/01/06
[2024/01/07]: https://draugus.github.io/diary/2024/01/07
[2024/01/08]: https://draugus.github.io/diary/2024/01/08
[2024/01/09]: https://draugus.github.io/diary/2024/01/09
[2024/01/10]: https://draugus.github.io/diary/2024/01/10
[2024/01/11]: https://draugus.github.io/diary/2024/01/11
[2024/01/12]: https://draugus.github.io/diary/2024/01/12
[2024/01/13]: https://draugus.github.io/diary/2024/01/13
[2024/01/14]: https://draugus.github.io/diary/2024/01/14
[2024/01/15]: https://draugus.github.io/diary/2024/01/15
[2024/01/16]: https://draugus.github.io/diary/2024/01/16
[2024/01/17]: https://draugus.github.io/diary/2024/01/17
[2024/01/18]: https://draugus.github.io/diary/2024/01/18
[2024/01/19]: https://draugus.github.io/diary/2024/01/19
[2024/01/20]: https://draugus.github.io/diary/2024/01/20
[2024/01/21]: https://draugus.github.io/diary/2024/01/21
[2024/01/22]: https://draugus.github.io/diary/2024/01/22
[2024/01/23]: https://draugus.github.io/diary/2024/01/23
[2024/01/24]: https://draugus.github.io/diary/2024/01/24
[2024/01/25]: https://draugus.github.io/diary/2024/01/25
[2024/01/26]: https://draugus.github.io/diary/2024/01/26
[2024/01/27]: https://draugus.github.io/diary/2024/01/27
[2024/01/28]: https://draugus.github.io/diary/2024/01/28
[2024/01/29]: https://draugus.github.io/diary/2024/01/29
[2024/01/30]: https://draugus.github.io/diary/2024/01/30
[2024/01/31]: https://draugus.github.io/diary/2024/01/31
27 changes: 26 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,19 @@ def everyday(y, m):
if m:
break
# print(res)
fo = open(project_path + "/" + y + "/README.md", "ab+")
filename=project_path + "/" + y + "/README.md"
fo = open(filename, "ab+")
fo.write(res.encode())
fo.close()

# 前两行是否有年
with open(filename, 'r') as file:
lines = file.readlines()
if lines and (y not in lines[0] and y not in lines[1]):
lines[0] = f"# {y}\n"
with open(filename, 'w') as file:
file.writelines(lines)



def add_prefix(a):
Expand Down Expand Up @@ -225,6 +235,8 @@ def cp_file():
os.mkdir(project_path + '/' + new_in[0])
os.mkdir(project_path + '/' + new_in[0] + '/' + new_in[1])
print("mkdir year and month, y m is ", new_in[0], new_in[1])
print("cp file: meanwhile add readme and all links about this month")
everyday(int(new_in[0]), int(new_in[1]))
else:
year_index = p1.index(new_in[0])
print("year index", year_index)
Expand Down Expand Up @@ -293,6 +305,19 @@ def modify_line(y, m, d):
find_str = '|' + d + '|'
cur_month_line_idx = -1
next_month_line_idx = 999999

# 防止没有该文件
# 检查文件是否存在
if not os.path.isfile(filename):
# 文件不存在,创建文件
with open(filename, 'w') as file:
# 文件已创建,可以在此处写入内容,如果不需要写入可以什么也不做
pass
else:
# 文件存在,不做任何操作
print("File already exists.")


with open(filename, "r+", encoding='utf-8') as file_handle:
all_line = file_handle.readlines()
for idx, ll in enumerate(all_line):
Expand Down

0 comments on commit c2da61b

Please sign in to comment.