convert 2 utf-8
#!/usr/bin/env python3
# encoding: utf-8
import os
import sys
#import chardet
dir = sys.argv[1]
#def convert(source_file):
#content = open(source_file, 'r').read().encode('UTF-8')
#open(source_file, 'w', encoding = 'UTF-8').write(content)
#open(source_file, 'w', encoding = 'UTF-8')
convert = lambda source_file: open(source_file, 'w', encoding = 'UTF-8')
def traverse():
for lists in os.listdir(dir):
path = os.path.join(dir, lists)
if os.path.isdir(path):
traverse(path)
convert(path)
if __name__ == '__main__':
traverse()