1234567891011121314151617 |
- import glob
- import os
- import sys
- import codecs
- rootdir = "./"
- source_encoding = "us-ascii"
- target_encoding = "utf-8"
- for root, subdirs, files in os.walk(rootdir):
- for filename in files:
- if filename[-4:] == ".txt":
- print(os.path.join(root, filename))
- source = codecs.open(os.path.join(root, filename), 'r', source_encoding).read()
- print(source)
-
|