zsz = trContent[6].find_all("td")[1].text[3:][:-1] ltsz = trContent[7].find_all("td")[1].text[3:][:-1] print "jlv" + trContent[4].find_all("td")[1].text[4:] # 获得解禁时间 jjSql = "select min(jjsj) jjsj from stock_jjsj where stockno='" + stockno + "' and jjsj>='" + importdate + "'" cursor.execute(jjSql) jjRow = cursor.fetchone() print jjRow if jjRow[0] == None: jjsj = "" else: jjsj = jjRow[0] # 获得上月收盘价 # 获得本日收盘价 # 获得上个月 pre_month = dateutil.get_pre_month() print pre_month syspjSQL = ( "select * from stock_day_data where date=(select max(date) from stock_day_data where code='" + stockno + "' and left(date,7)='" + pre_month + "') and code='" + stockno + "' " ) brspjSQL = "select * from stock_day_data where date like'" + importdate + "%' and code='" + stockno + "'" cursor.execute(syspjSQL) syspjRow = cursor.fetchone() print syspjRow if syspjRow == None: