***can't delete function call(my_dictionary.py, line 21)
Имеется такое:
# -*- coding: cp1251 -*-
class Phone_dict:
def __init__(self):
self.f = open('****','rw')
self.dict = {}
for line in self.f:
self.dict[line.split(':')[0].strip()] = line.split(':')[1].strip()
self.f.close()
def fill_dict_phone(self,dname,phone):
self.dict[str(dname)] = str(phone)
def close(self):
self.f.close()
def show(self):
for name in self.dict.keys():
print str(name) +" : "+ str(self.dict[name])
def delete(self):
self.dict.clear()
def del_phone(self,name):
del self.dict(name)
def save_to(self):
self.f = open('***','w')
for i in self.dict.keys():
self.f.write(str(i)+':'+str(self.dict[i] )+"\n")
self.f.close()
if __name__=='__main__':
d = Phone_dict()
При выполнении пишет "***can't delete function call(my_dictionary.py, line 21)"
21 строка - это та, которую я выделил.
Подскажите, в чем проблема...
# -*- coding: cp1251 -*-
class Phone_dict:
def __init__(self):
self.f = open('****','rw')
self.dict = {}
for line in self.f:
self.dict[line.split(':')[0].strip()] = line.split(':')[1].strip()
self.f.close()
def fill_dict_phone(self,dname,phone):
self.dict[str(dname)] = str(phone)
def close(self):
self.f.close()
def show(self):
for name in self.dict.keys():
print str(name) +" : "+ str(self.dict[name])
def delete(self):
self.dict.clear()
def del_phone(self,name):
del self.dict(name)
def save_to(self):
self.f = open('***','w')
for i in self.dict.keys():
self.f.write(str(i)+':'+str(self.dict[i]
self.f.close()
if __name__=='__main__':
d = Phone_dict()
При выполнении пишет "***can't delete function call(my_dictionary.py, line 21)"
21 строка - это та, которую я выделил.
Подскажите, в чем проблема...
