python list.append(values) adding L to values -


this question has answer here:

i'm experiencing weird behavior when appending values python list. using openpyxl read values of multiple excel files, math , write them new excel file. when looping through rows in header column , appending values list, final result of list value of cell plus 'l'. example, here relevant pieces of code:

xl_file = 'path/to/excel/file.xlsx' wb = openpyxl.load_workbook(xl_file, data_only=true) sheet = wb.get_sheet_by_name("sheetname")  hdr_col = [] # empty list store contents of column header r in range(3, 13): # want rows 3-12. rows 1 , 2 of column hdr empty     val = sheet.cell(row=r, column = 1).value     print val # prints actual value (1, 2, 3,..., 10)     hdr_col.append(val) print hdr_col # prints values l, i.e.: 

[1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l, 9l, 10l]

can explain me what's going on? @ first thought openpyxl module l gets added after appending value list i'm thinking it's python.

because print returns human readable format while if use repr in place of print @ statement print val find 'l' appended every integer

check here

in [52]: = 1l  in [53]: print 1  in [54]: type(a) out[54]: long  in [58]: repr(a) out[58]: '1l'  in [55]: s = []  in [56]: s.append(a)  in [57]: s out[57]: [1l] 

because mysql , other databases stores integer value long.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -