Created
December 30, 2018 03:44
-
-
Save BababaBlue/8f1784a6ddc7bedcd87de3bee5073f2c to your computer and use it in GitHub Desktop.
this was used to get the website urls
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
import mysql.connector | |
a=[] | |
b=[] | |
with open('list.txt') as f: | |
for row in f: | |
row=row.strip('\n') | |
a.append(row) | |
mydb = mysql.connector.connect( | |
host="#", | |
user="#", | |
passwd="#", | |
database="#" | |
) | |
mycursor = mydb.cursor() | |
for tablename in a: | |
tablename1=str(tablename) | |
mycursor.execute("SELECT option_value FROM %s WHERE option_id=1"%tablename1) | |
myresult = mycursor.fetchall() | |
for x in myresult: | |
b.append(x) | |
with open("websites.txt", "w") as f: | |
for s in b: | |
f.write(str(s) +"\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment