Last active
August 22, 2018 11:37
-
-
Save gubiithefish/b8b6e4298585efc43b66268dff8f2d22 to your computer and use it in GitHub Desktop.
A small code for escaped html files which unescapes and moves them to another folder.
This file contains 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 html | |
import io | |
import os | |
from_dir_path = 'C:\\Users\\gubii\\Desktop\\testmappe\\txt\\Michael\\' #AlleFilerSkalLiggeHer | |
to_dir_path = 'C:\\Users\\gubii\\Desktop\\testmappe\\txt\\Michael2\\' | |
for files in os.listdir(from_dir_path): | |
file = open(from_dir_path + files, encoding="utf8") | |
text = file.readlines() | |
if files not in os.listdir(to_dir_path): | |
new_file = io.open(to_dir_path + files, "w", encoding="utf-8") | |
for lines in range(len(text)): | |
new_file.writelines(html.unescape(text[lines])) | |
new_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment