This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import csv | |
| original_dir = 'first' | |
| new_dir = 'other' | |
| output_dir = 'output' | |
| for (root, dirs, files) in os.walk(original_dir): | |
| for filename in files: | |
| relpath = os.path.join(root, filename) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| doc[row['key']] = row['trans'] | |
| # Write | |
| output_path = os.path.join(output_dir, relpath[len(original_dir) + 1:]) | |
| output_path_dir = os.path.dirname(output_path) | |
| if not os.path.exists(output_path_dir): | |
| os.makedirs(output_path_dir) | |
| with open(output_path, 'w') as csvfile: | |
| writer = csv.writer(csvfile, delimiter=",", quotechar='"', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import csv | |
| from collections import OrderedDict | |
| original_dir = os.path.abspath('original') | |
| new_dir = os.path.abspath('new_translations') | |
| output_dir = os.path.abspath('output') | |
| for (root, dirs, files) in os.walk(original_dir): | |
| for filename in files: |
OlderNewer