[root@yyjk DATABASE]# cat a1.py
# -*- coding: utf-8 -*-
import cx_Oracle
import time
import datetime
class DBI (object):
def LoadDB(self,a,b):
print self
conn = cx_Oracle.connect('tlcbuser/tlcbuser@10.5.100.232/tlyy')
cursor = conn.cursor()
#coding:UTF-8
#获取当前时间
time_now = int(time.time())
#转换成localtime
#time_local = time.localtime(time_now)
#print time_local
#dt = time.strftime("%Y-%m-%d %H:%M:%S",time_local)
dt=datetime.datetime.now()
print dt
param={'stime':dt,'message':a,'phone':b}
print param;
cursor.execute('insert into tlcb_python_sms values(:stime,:message,:phone)',param)
conn.commit()
cursor.close
a=DBI()
print a
print type(a)
a.LoadDB('aaa','18072722237')