Current location - Health Preservation Learning Network - Healthy weight loss - Which Python library can delete a row or a column in an Excel table?
Which Python library can delete a row or a column in an Excel table?
Openpyxl version or later can delete a row or a column in an Excel table.

Sample code:

From where? openpyxl? Import? *。

File name? =? ' test.xlsx ' .

wb? =? wb? =? Load the workbook (file name).

ws? =? wb.active .

ws.delete_rows(2,2)? # Delete two lines after index 2.

Extended data:

When Python executes. The py file will be compiled into Python bytecodes, and then the Python Virtual Machine will execute these compiled bytecodes.

The basic idea of this mechanism is related to Java and. Net. However, Python virtual machines are different from Java or. NET virtual machine, Python virtual machine is a more advanced virtual machine.

Baidu encyclopedia -Python