Automatically exported from code.google.com/p/planningalerts
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

30 wiersze
810 B

  1. #!/usr/bin/python
  2. list_of_sites_filename = "PublicAccessSites.csv"
  3. template_filename = "CGITemplate"
  4. python_location = "/usr/bin/python"
  5. import csv
  6. from os import chmod
  7. list_of_sites_file = open(list_of_sites_filename)
  8. csv_reader = csv.DictReader(list_of_sites_file, quoting=csv.QUOTE_ALL, skipinitialspace=True)
  9. template_contents = open(template_filename).read()
  10. template = "#!" + python_location +"\n\n" + template_contents
  11. for site_dict in csv_reader:
  12. filename = "%s.cgi" %site_dict["authority_short_name"]
  13. contents = template %site_dict
  14. this_file = open(filename, "w")
  15. print "Writing %s" %filename
  16. this_file.write(contents)
  17. this_file.close()
  18. chmod(filename, 0755)
  19. # need to look at:
  20. # "Perth and Kinross Council", "Perthshire", "http://193.63.61.22/publicaccess/"