import re codecs class Proff def __init__ self self name self familyna

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import re, codecs
b = []
class Proff:
def __init__(self):
self.name = ''
self.familyname = ''
self.fathername = ''
self.adress = ''
self.phone = ''
self.email = ''
def searching(self, a):
text = codecs.open(txt, 'r', 'utf-8')
self.a = text.read()
for line in self.a:
b += line.split()
for f in b:
f = re.findall(u'(А[а-я]*?) ([А-Я][а-я]*?) ([А-Я][а-я]*?)\r\n', f)
for i in f:
if i != None:
self.name = i[0]
self.familyname = i[2]
self.fathername = i[1]
for c in b:
c = re.findall(u'Адрес:([а-яА-Я0-9.,/])?\r\n\r\n', c)
for i in c:
if i != None:
self.adress = i[0]
for d in b:
d = re.findall(u'Телефон:([0-9])?\r\n\r\n', d)
for i in d:
if i != None:
self.phone = i[0]
for e in b:
e = re.findall(u'E-mail:<p>Скрыт</p>([a-zA-Z0-9_.]@[a-z]\.[a-z])?\r\n\r\n', e)
for i in d:
if i != None:
self.email = i[0]
q = Proff('list.txt')
print Proff()