2023年12月4日,周一上午
#!/usr/bin/env python
import os
# 执行系统命令
os.system("ls -l")
# 获取当前工作目录
current_dir = os.getcwd()
print("Current working directory:", current_dir)
# 列出目录中的文件和子目录
files = os.listdir(current_dir)
for file in files:
print(file)
# 创建一个新目录
new_dir = os.path.join(current_dir, "new_directory")
os.makedirs(new_dir)
print("New directory created:", new_dir)