File size: 521 Bytes
032e687
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os

import argparse

parser = argparse.ArgumentParser()
parser.add_argument("folder_path", type=str, )
args = parser.parse_args()

files_names = os.listdir(args.folder_path)
ids = []
for name in files_names:
    if '.txt' not in name:
        pass
    else:
        _id = name.replace('.txt', '')
        ids.append(_id)

final_text = ''
for _id in ids:
    final_text += _id
    final_text += '\n'
with open(os.path.join(args.folder_path, 'id_list.txt'), 'w', encoding='utf-8') as file:
    file.write(final_text)