Home > other > Writing table data using XLWT loop program error Traceback (the most recent call last) :
Writing table data using XLWT loop program error Traceback (the most recent call last) :
Time:10-03
The code The import XLWT Workbook=XLWT. Workbook () Worksheet=workbook. Add_sheet (' sheet1) Data=https://bbs.csdn.net/topics/np.arange (1, 65). Reshape (8, 8) For r in the range (8) : For c in range (8) : Worksheet. Write (r, c, data/r, c) Workbook. Save (' F: \ data \ ex4. XLS)
An error display: Traceback (the most recent call last) : The File "F: pyx/01. Py", line 157, in & lt; module> Worksheet. Write (r, c, data/r, c) File "F: \ python \ lib \ site - packages \ XLWT \ Worksheet py", line 1088, in the write The self. The row (r). Write (c, label, style) File "F: \ python \ lib \ site - packages \ XLWT \ Row py", line 254, in the write Raise the Exception (" Unexpected data type % r "% type (label)) Exception: Unexpected data type & lt; The class 'numpy. Int32 & gt;
Can't use the data (r, c) I tried to put the data (r, c) modified into 0, Run successfully