def catch_ptt_max_index(ptt_class_name,sql_name):
conn = ( pymysql.connect(host = '114.34.138.146',
port = 3306,
user = user,
password = password,
database = database,
charset="utf8") )
cursor = conn.cursor()
cursor.execute('SELECT * FROM `'+ sql_name +'` ORDER BY id DESC LIMIT 1;')
data = cursor.fetchone()
index = data[10]
index = index.replace('http://www.ptt.cc/bbs/'+ ptt_class_name +'/index','')
index = index.replace('.html','')
index = int(index)
cursor.close()
conn.close()
return index
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
# ? SQL ? data ???, ?data?????? SQL ? max data time
评论列表
文章目录