oracle超過4000的字符 如何用python讀取oracle數(shù)據(jù)庫?
如何用python讀取oracle數(shù)據(jù)庫? 下載cx_Oracle,下載之后就可以使用了。 簡單的使用流程如下:1.引用模塊cx_Oracle2.連接數(shù)據(jù)庫3.獲取cursor4.使用cursor進行
如何用python讀取oracle數(shù)據(jù)庫?
下載cx_Oracle,下載之后就可以使用了。
簡單的使用流程如下:
1.引用模塊cx_Oracle2.連接數(shù)據(jù)庫3.獲取cursor4.使用cursor進行各種操作5.關閉cursor6.關閉連接
參考代碼:
import cx_Oracle #引用模塊cx_Oracleconn=cx_Oracle.connect("load/123456@localhost/ora11g") #連接數(shù)據(jù)庫c=conn.cursor() #獲取cursorx=c.execute("select sysdate from dual") #使用cursor進行各種操作x.fetchone()c.close() #關閉cursorconn.close() #關閉連接
Python中如何利用Pandas讀取Excel中的數(shù)據(jù)?
1、打開電腦,在桌面鼠標右鍵選擇新建excel工作表;接著打開工作表,在sheet1插入一個表格。
2、然后在excel表格sheet2,插入另一個表格數(shù)據(jù)。
3、雙擊打開pycharm工具,新建python文件,導入pandas包;調(diào)用read_excel()方法讀取excel文件數(shù)據(jù)。
4、保存代碼并運行python文件,結(jié)果出現(xiàn)了報錯,缺少xlrd包。
5、點擊File菜單,選擇Settings,找到項目對應的Project Interpreter,安裝xlrd。
6、安裝完畢后,再次運行代碼,可以查看到控制臺打印出excel文件數(shù)據(jù)。