cursor的description 可以获得一些关于表的信息

info=cursor.description
此时表中有多少列就有多少个元素,一个元素就是一列的信息(格式是tuple),所以这里的info是个2层的tuple。
想要获得所有的列名,就用info[0][0], info[1][0], ......
在打开excel时,第一行默认是标题,不可更改。
打开不同的数据库就是连接不同,其他的用法都一样。
=========================================================
下面的来自官网,对description的说明
https://github.com/mkleehammer/pyodbc/wiki/Cursor#description

description

This read-only attribute is a list of 7-item tuples, one tuple for each column returned by the last SQL select statement. Each tuple contains:

  1. column name (or alias, if specified in the SQL)
  2. type code
  3. display size (pyodbc does not set this value)
  4. internal size (in bytes)
  5. precision
  6. scale
  7. nullable (True/False)

最新文章

  1. Redis-3.2.6 配置文件中文翻译
  2. hdu 1872(看病要排队)(优先队列)
  3. js一篇汇总
  4. python scrapy+Mongodb爬取蜻蜓FM,酷我及懒人听书
  5. DB2 日期相减
  6. (转)使用myeclipse生成实体类和hibernate映射文件
  7. Spring框架学习(二)
  8. JS和JQuery总结
  9. dos 下 查看和设置classpath的命令
  10. SqlServer日期(convert函数,getdate函数)
  11. JAR WAR EAR包的区别
  12. cocos2dx 魔塔项目总结(一)
  13. Generic(泛型)
  14. nyoj 开方数
  15. UVA4731:Cellular Network
  16. nodejs 搭建本地静态服务器
  17. Java并发编程-AbstractQueuedSynchronizer源码分析
  18. ajax二次封装之异步加载
  19. 【LOJ】 #2547. 「JSOI2018」防御网络
  20. h5新属性

热门文章

  1. Wannafly Camp 2020 Day 3F 社团管理 - 决策单调性dp,整体二分
  2. PHP 冷知识
  3. Ubuntu 18.04安装配置Apache Ant
  4. UVA12124 | Assemble (二分)
  5. 题解【洛谷P2679】[NOIP2015]子串
  6. Spring的代理模式(静态,JDK,CGLIB)
  7. Appium+python自动化-元素定位uiautomatorviewer的使用
  8. webpack 之使用vue
  9. CI系列之配置sonar
  10. uipath_excel