Skip to content

Instantly share code, notes, and snippets.

@shionryuu
Created June 11, 2015 12:19
Show Gist options
  • Save shionryuu/3d99d38ffaeaf3f89d37 to your computer and use it in GitHub Desktop.
Save shionryuu/3d99d38ffaeaf3f89d37 to your computer and use it in GitHub Desktop.
Python Challenge 02
#!/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