Skip to content

Instantly share code, notes, and snippets.

@elliotwms
Last active August 29, 2015 14:09
Show Gist options
  • Save elliotwms/ccd5ad1619b08cb6b784 to your computer and use it in GitHub Desktop.
Save elliotwms/ccd5ad1619b08cb6b784 to your computer and use it in GitHub Desktop.
Parse a text file of websites into an SQL INSERT statement
#! /usr/bin/env python
f = open('output.sql', 'w');
f.write('INSERT INTO websites (url) VALUES\n')
for line in open("websites.txt",'r'):
f.write('(\''+line.strip()+'\'),\n')
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment