hytos / minorTools / makeallowable / makeallowables.py @ 7c29f267
이력 | 보기 | 이력해설 | 다운로드 (800 Bytes)
1 |
import os |
---|---|
2 |
|
3 |
input_path = os.path.join("E:\Projects\DTIPID_GERRIT\minorTools\makeallowable", "nominal.txt") |
4 |
output_path = os.path.join("E:\Projects\DTIPID_GERRIT\minorTools\makeallowable", "nominal2.txt") |
5 |
fw = open(input_path, 'r', encoding='utf8') |
6 |
contents = fw.read() |
7 |
fw.close() |
8 |
contents = contents.split('\n')[:-1] |
9 |
|
10 |
allowables = [] |
11 |
for text in contents: |
12 |
allowable = text.replace('\"', '\'') |
13 |
allowable += ',' + text.replace('\"', 'II') |
14 |
if '-' in text: |
15 |
allowable += ',' + text.replace('-', '') |
16 |
allowable += ',' + text.replace('-', '').replace('\"', '\'') |
17 |
allowable += ',' + text.replace('-', '').replace('\"', 'II') |
18 |
|
19 |
allowables.append(allowable) |
20 |
|
21 |
|
22 |
allowables = '\n'.join(allowables)
|
23 |
fw = open(output_path, 'w', encoding='utf8') |
24 |
fw.write(allowables) |
25 |
fw.close() |
26 |
|