|
@@ -3,9 +3,9 @@ import os
|
|
import sys
|
|
import sys
|
|
import codecs
|
|
import codecs
|
|
|
|
|
|
-rootdir = "./"
|
|
|
|
|
|
+rootdir = "./units"
|
|
|
|
|
|
-source_encoding = "us-ascii"
|
|
|
|
|
|
+source_encoding = "ANSI"
|
|
target_encoding = "utf-8"
|
|
target_encoding = "utf-8"
|
|
|
|
|
|
for root, subdirs, files in os.walk(rootdir):
|
|
for root, subdirs, files in os.walk(rootdir):
|
|
@@ -13,5 +13,8 @@ for root, subdirs, files in os.walk(rootdir):
|
|
if filename[-4:] == ".txt":
|
|
if filename[-4:] == ".txt":
|
|
print(os.path.join(root, filename))
|
|
print(os.path.join(root, filename))
|
|
source = codecs.open(os.path.join(root, filename), 'r', source_encoding).read()
|
|
source = codecs.open(os.path.join(root, filename), 'r', source_encoding).read()
|
|
- print(source)
|
|
|
|
-
|
|
|
|
|
|
+ print(u''.join(source))
|
|
|
|
+
|
|
|
|
+ final = open(os.path.join(root, filename), 'w')
|
|
|
|
+ print(u''.join(source), file = final)
|
|
|
|
+ final.close()
|