Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- class Note(object):
- Id = 0
- def __init__(self, text, tag):
- Note.Id += 1
- self.ID = Note.Id
- self.tag = tag
- self.text = text
- self.data = datetime.datetime.now()
- def match(self):
- if isinstance(self.__text, str) or isinstance(self.__tag, str):
- return True
- else:
- return False
- def __str__(self):
- return f"Id: {self.ID}\t\t\tData: {self.data}\n\tTag:\t\t\t{self.tag},\n\tText:\t\t\t{self.text}"
- class Notebook(Note):
- def __init__(self):
- self.notes = []
- def new_note(self, ob):
- self.notes.append(ob)
- def __str__(self):
- return super(Notebook, self).__str__()
- def main():
- notatka = Note("text", "tag")
- note = Notebook()
- note.new_note(notatka)
- print(note)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement