Created
April 27, 2018 10:34
-
-
Save tylercubell/66596161496054ffeb813fd85284a3ee to your computer and use it in GitHub Desktop.
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, subprocess | |
# Remove null characters. | |
# http://gnuwin32.sourceforge.net/packages/coreutils.htm | |
file = "your_file_here" | |
command = ["C:\\Program Files (x86)\\GnuWin32\\bin\\tr.exe", | |
"-d \'\\000\'"] | |
with open(file, "r") as original, open(file + ".new", "w", encoding="utf-8") as modified: | |
subprocess.Popen(" ".join(command), stdin=original, stdout=modified).wait() | |
os.remove(file) | |
os.rename(file + '.new', file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment