python 读取一个表数据处理写入另一个表_python实现获取一个表数据插入另外一个库中的表...

#!/usr/bin/env python

# _*_ conding:utf-8 _*_

import sys

import os

import time

import datetime

import MySQLdb

bb=datetime.datetime.now()

c_time=time.strftime("%Y%m%d",time.localtime(time.time()))

today=datetime.date.today()

oneday=datetime.timedelta(days=1)

yesterday=today-oneday

yes_last=datetime.datetime.strftime(yesterday,"%Y%m%d")

print yes_last

#print c_time

try:

conn1=MySQLdb.connect(host='192.168.1.17',user='dlan',passwd='root123',port=3306,db='chat')

conn2=MySQLdb.connect(host='192.168.1.17',user='dlan',passwd='root123',port=3306,db='test')

cur1 = conn1.cursor()

cur2 = conn2.cursor()

aa1='''

你可能感兴趣的:(python,读取一个表数据处理写入另一个表)