Question I want to compare a full name with the persons initials but, for some reason I keep getting this error. Any help will be greatly appreciated!
#check.py", line 27, in check_fn a = self.my_name AttributeError: 'Check' object has no attribute 'my_name'
import re
class Check(object):
def __init__(self, word):
self.word = word
def abbr(self):
e = self.word
w = self.word[:1]
lens = len(self.word)
last = self.word[-1:]
all = '%s%s%s' %(w, lens, last)
key_a = []
key_b = []
app_a = key_a.append(e)
app_b = key_b.append(all)
dictonary = dict(zip(key_a, key_b))
self.check_fn(e, all)
return dictonary
def check_fn(self, my_name, intials):
a = self.my_name
b = self.intials
list_a = []
list_b = []
aa = list_a.append(a)
bb = list_b.append(b)
for element in list_a:
m = re.match("(^['%s' %(list_b)]\d)", element)
if m:
print(m.groups())