1515else :
1616 from io import BytesIO as StringIO
1717
18+
1819COLUMNS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1920COLUMN_LENGTH = 26
2021
22+
2123def get_columns (index ):
2224 if index < COLUMN_LENGTH :
2325 return COLUMNS [index ]
2426 else :
25- return get_columns (int (index / COLUMN_LENGTH )) + COLUMNS [index % COLUMN_LENGTH ]
26-
27+ return (get_columns (int (index / COLUMN_LENGTH )) +
28+ COLUMNS [index % COLUMN_LENGTH ])
29+
2730
2831class XLSXSheet (SheetReader ):
2932 """
@@ -50,7 +53,9 @@ def cell_value(self, row, column):
5053 Random access to the xls cells
5154 """
5255 actual_row = row + 1
53- return self .native_sheet .cell ("%s%d" % (get_columns (column ), actual_row )).value
56+ cell_location = "%s%d" % (get_columns (column ), actual_row )
57+ return self .native_sheet .cell (cell_location ).value
58+
5459
5560class XLSXBook (BookReader ):
5661 """
@@ -84,7 +89,8 @@ def write_row(self, array):
8489 write a row into the file
8590 """
8691 for i in range (0 , len (array )):
87- self .native_sheet .cell ("%s%d" % (get_columns (i ), self .current_row )).value = array [i ]
92+ cell_location = "%s%d" % (get_columns (i ), self .current_row )
93+ self .native_sheet .cell (cell_location ).value = array [i ]
8894 self .current_row += 1
8995
9096
@@ -100,9 +106,11 @@ def __init__(self, file, **keywords):
100106 def create_sheet (self , name ):
101107 if self .current_sheet == 0 :
102108 self .current_sheet = 1
103- return XLSXSheetWriter (self .native_book , self .native_book .active , name )
109+ return XLSXSheetWriter (self .native_book ,
110+ self .native_book .active , name )
104111 else :
105- return XLSXSheetWriter (self .native_book , self .native_book .create_sheet (), name )
112+ return XLSXSheetWriter (self .native_book ,
113+ self .native_book .create_sheet (), name )
106114
107115 def close (self ):
108116 """
@@ -126,4 +134,4 @@ def close(self):
126134 # to allow this module to function independently
127135 pass
128136
129- __VERSION__ = "0.0.1 "
137+ __VERSION__ = "0.0.2 "
0 commit comments