Python operation excel table xlrd, xlwt

Learning of xlrd module in python

1. The xlrd module is mainly used for reading excel tables, supporting xlsx and xls; xlwt is mainly used for writing excel and reading libraries

2. Data types in common cells

0, empty (empty); 1, string (text); 2, number; 3, date; 4, boolean; 5, error; 6, blank (blank form)    

use

One, import the module

import xlrd

2. Open the excel file to read the data (the file was created first)

 

data = xlrd.open_workbook('study.xls') #File name and path, if the path or file name has Chinese, add an r to the front to indicate native characters; for example,'rlearn.xls'

 

Three, xlrd module operation

1. Basic functions

1.1. Open the workbook to get the Book object

  • xlrd.open_workbook(filename[, logfile, file_contents, ...]): open excel file
    filename: file name to be operated (including file path and file name);

If filename does not exist?

Guess you like

Origin blog.csdn.net/yang520java/article/details/107249633