Skip to content

Instantly share code, notes, and snippets.

@Xotabu4
Created April 7, 2016 12:07
Show Gist options
  • Select an option

  • Save Xotabu4/7eca87e4efffceb9694db06cc389a954 to your computer and use it in GitHub Desktop.

Select an option

Save Xotabu4/7eca87e4efffceb9694db06cc389a954 to your computer and use it in GitHub Desktop.
# coding=utf-8
ALPHABET = u'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'
with open('text.txt') as f:
lines = f.readlines()
lines = [line.decode("utf-8") for line in lines]
print '###TASK 1:'
for line in lines:
if len(line) > 20:
print line
print '###TASK 2'
text_no_lines = ''.join(lines)
CODES = []
for letter in ALPHABET:
CODES.append(text_no_lines.rfind(letter))
for code, letter in zip(CODES, ALPHABET):
print code, letter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment