mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2026-03-22 15:07:17 +08:00
style: 代码格式化和字符串处理优化
- 优化代码缩进和换行,提高可读性 - 统一使用单引号或双引号,保持一致性 - 移除冗余的空格和括号,精简代码
This commit is contained in:
@@ -4,14 +4,14 @@ ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def find_python_files(dir_, file):
|
||||
with open(file, 'w', encoding='utf-8') as f:
|
||||
for py_file in dir_.rglob('*.py'): # 递归查找所有 .py 文件
|
||||
f.write(str(py_file) + '\n') # 写入文件路径
|
||||
with open(file, "w", encoding="utf-8") as f:
|
||||
for py_file in dir_.rglob("*.py"): # 递归查找所有 .py 文件
|
||||
f.write(str(py_file) + "\n") # 写入文件路径
|
||||
|
||||
|
||||
# 设置源目录和输出文件
|
||||
source_directory = ROOT.joinpath("source") # 源目录
|
||||
output_file = 'py_files.txt' # 输出文件名
|
||||
output_file = "py_files.txt" # 输出文件名
|
||||
|
||||
find_python_files(source_directory, output_file)
|
||||
print(f"所有 .py 文件路径已保存到 {output_file}")
|
||||
|
||||
Reference in New Issue
Block a user