countries.py 408 B

123456789101112131415161718
  1. #!/usr/bin/env python3
  2. import json
  3. class Country:
  4. def __init__(self, id, code, name):
  5. self.id = id
  6. self.code = code
  7. self.name = name
  8. countries = [ Country(1, "ATL", "Atlantis").__dict__ ,
  9. Country(2, "GL", "Greenland").__dict__ ,
  10. Country(3, "ZOO", "Zooland").__dict__ ]
  11. print("Content-type: application/json")
  12. print("")
  13. print(json.dumps(countries))