python 多线程模型(主线程14个子线程)

#coding=utf-8
import threading
import time
import cx_Oracle
from pprint import pprint
import csv
table_name = "dbtest.csv"
f = open(table_name + ".csv", "w")

def exp01():
  conn = cx_Oracle.connect('tlcbuser/[email protected]/tlyy')
  cursor = conn.cursor()
  owner = "system"
  writer = csv.writer(f, lineterminator="\n", quoting=csv.QUOTE_NONNUMERIC)
  tname = threading.current_thread()
  print tname
  exportOracleSql = "select 'exp01' from dual"
  print exportOracleSql
  x = cursor.execute(exportOracleSql)
  time.sleep(11)
  cursor.close()
  conn.close()

def exp02():
  conn = cx_Oracle.connect('tlcbuser/[email protected]/tlyy')
  cursor = conn.cursor()
  owner = "system"
 

你可能感兴趣的:(python,多线程,python)