localblitz

Untitled

Sep 5th, 2019
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import csv
  2.  
  3. lines = list(csv.reader(open('data/data.csv')))[1]
  4.  
  5.  
  6. template_data = open('data/template.html').read()
  7.  
  8. for line in lines:
  9.     if not line:
  10.         continue
  11.     print line
  12.     filename = 'outputs/{}.html'.format(line[1].replace(' ', '_'))
  13.     filename_data = template_data.replace('[URL]', line[0])
  14.     open(filename, 'w').write(filename_data)
  15.  
  16. ## data.csv with headers URL,Keyword
  17. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  18. <meta http-equiv="Refresh" content="0; URL=[URL]">
  19. mysite.com,keywword
RAW Paste Data