Created
February 5, 2010 07:47
-
-
Save yono/295616 to your computer and use it in GitHub Desktop.
DB中のURLをTeXのリスト形式にして出力
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
import sys | |
import MySQLdb | |
con = MySQLdb.connect(db='webpage_test',user='',passwd='', | |
use_unicode=True,charset='utf8') | |
cur = con.cursor() | |
first = int(sys.argv[1]) | |
num = int(sys.argv[2]) | |
cur.execute('select url from webpage_test limit %d,%d' % (first,num)) | |
rows = cur.fetchall() | |
for row in rows: | |
url = row[0].replace('&',r'\&').replace('%',r'\%').replace('_',r'\_') | |
print r'\item',url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment