今天在运行2019年8月运用openpyxl库写的code时,出现了error提示,有点懵;
运行错误提示如下:
py:14: DeprecationWarning: Call to deprecated function get_sheet_by_name (Use wb[sheetname]).
sheet=wb1.get_sheet_by_name("Sheet2")
解决方案:(改变读取sheet name的书写方式)
sheet=wb1["Sheet2"]
问题原因在于:openpyxl库读取sheet name的书写方式好像更改了。
老方式:(舍弃掉)
sheet=wb1.get_sheet_by_name("Sheet2")
新方式:
sheet=wb1["Sheet2"]