import os import MySQLdb Con= MySQLdb.connect(host=',db='test') #链接数据库 cur=Con.cursor() os.chdir("E:/etl_folder") #改变工作路径 for i in os.listdir(os.getcwd()): #得到工作路径下的文件 if(os.path.isfile(i)): aa= os.getcwd()+"\\"+i #文件夹操作是\\是\因为转移符的原因 a
http://stackoverflow.com/questions/4960048/python-3-and-mysql up vote61down votefavorite 20 I am using ActiveState Python 3 on Windows and wanted to connect to my MySQL database. I heard that mysqldb was the module to use. I can't find mysqldb for Py
python多线程同步 作者:vpoet 日期:大约在夏季 import threading import time mylock = threading.RLock() num=0 class myThread(threading.Thread): def __init__(self, name): threading.Thread.__init__(self) self.t_name = name def run(self): global num while True: mylock.ac
Python 連接 MySQL MySQL 是十分流行的開源資料庫系統,很多網站也是使用 MySQL 作為後台資料儲存,而 Python 要連接 MySQL 可以使用 MySQL 模組.MySQLdb 模組可以讓 Python 程式連線到 MySQL server, 執行 SQL 語句及擷取資料等. 開始前要確定系統內的 Python 有安裝 MySQLdb 模式,你可以 Python command line interpreter 檢查,在指令模式輸入 python,然後便可以開始檢查: P