Created
May 29, 2019 06:22
-
-
Save flow2k/8bd4fece21fa1a0b75737a3d9fc2e86c to your computer and use it in GitHub Desktop.
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
numBads = 0 | |
with open(filename, encoding="utf-8", errors="strict") as f: | |
while True: | |
try: | |
line = f.readline() | |
if not line: | |
break | |
print(line) | |
except UnicodeDecodeError: | |
numBads += 1 | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment