Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def writeToCell(self,sku, header_name, cell_input):
- '''
- Creates a copy of a file and writes to a cell
- '''
- line_list = self.orig.replace('\r','').split('\n')
- self.infoLogger(type(cell_input),type(row_index),type(column_index))
- results = returnRowBySku(sku) #[[headers],[line]]
- self.header_index = results[0].index(header_name)
- results[1][self.header_index] = cell_input
- self.tmp = self.orig.replace('\r','')
- lines = self.tmp.split('\n')
- insert_line = ','.join(results[1][self.header_index])
- final_list = []
- for line in lines:
- if insert_line in line:
- final_list.append(insert_line)
- else:
- final_list.append(line)
- if len(final_list) is 0:
- print(traceback.format_exc())
- exit()
- results = self.writeCsvFile('\n'.join(final_list))
- return results
Advertisement
Add Comment
Please, Sign In to add comment