From a59d8c977eac3eb5c71870815730e4c9bf35bad2 Mon Sep 17 00:00:00 2001 From: gilad_ilsar Date: Thu, 22 Sep 2016 16:55:33 +0300 Subject: parser into csv --- entities/location.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'entities/location.py') diff --git a/entities/location.py b/entities/location.py index 064b193..a43eb8d 100644 --- a/entities/location.py +++ b/entities/location.py @@ -1,3 +1,5 @@ +import json + from entities.basic_entity import BasicEntity @@ -8,8 +10,16 @@ class Location(BasicEntity): self.name_in_langs = name_in_langs self.comments_list = comments_list + CSV_FIELDS = ["name", "comments"] + TYPE = "LOCATION" + + def print_entity(self): print("Name = " + self.name) print("Name in langs = " + str(self.name_in_langs)) print("Types = " + str(self.types_of_place)) print("Comments = " + str(self.comments_list)) + + def to_csv_dict(self): + return {'name': self.name, + 'comments': json.dumps(self.comments_list, ensure_ascii=False)} -- cgit v1.2.3