Created
June 11, 2015 12:19
-
-
Save shionryuu/3d99d38ffaeaf3f89d37 to your computer and use it in GitHub Desktop.
Python Challenge 02
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
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
# http://www.pythonchallenge.com/pc/def/ocr.html | |
import re | |
# the content of rare_characters.txt is from the | |
# source of ocr.html | |
with open('rare_characters.txt', 'r') as file1: | |
content = file1.read() | |
print ''.join(re.findall('[A-Za-z]', content)) | |
# or | |
file2 = open('rare_characters.txt', 'r') | |
content = file2.read() | |
print ''.join(re.findall('[A-Za-z]', content)) | |
file2.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment