I have finished a really short and small import / export script using Python 2.7, and now I would like to structure it using classes and methods where possible.
Could anybody give me some advice on what would be the best approach for this?
I haven't used any OOP because I would also like somebody to give me some best practices on how this should be done/structured.
from similarweb import ContentClient import csv FILE_OUT = 'similarweb/new_domains.csv' FILE_IN = 'similarweb/domains.csv' content_client = ContentClient("some_key") final_result = "" with open(FILE_IN, 'r') as csv_read_file: reader = csv.reader(csv_read_file) for i, line in enumerate(reader): url = ', '.join(str(e) for e in line) final_result += url + " " + (content_client.category(url)['Category']) + "\n" with open(FILE_OUT, 'w') as csv_write_file: csv_write_file.write(final_result)