import os
def create_file_with_filenames(folder_path, output_file_path):
# 获取文件夹下面的文件名
file_names = os.listdir(folder_path)
# 创建文本文件并写入文件名
with open(output_file_path, 'w') as output_file:
for file_name in file_names:
output_file.write(file_name + '\n')
# 例子:传入文件夹路径和输出文件路径
folder_path = '' # 替换为你的文件夹路径
output_file_path = '' # 替换为你的输出文件路径
create_file_with_filenames(folder_path, output_file_path)