![]() |
Need help | splitting list into list - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Need help | splitting list into list (/thread-16733.html) |
Need help | splitting list into list - Vinci141 - Mar-12-2019 Hello, My need is to read an excel, split data from a specific column , turn it into array of characters so that i print them into excel into 9 cells and color few characters. Below is my approach so far. If incorrect, please rectify. 1 Read data from excel file [Done] 2 Put column data into a list as below [Done] for row in range( 1, sheet.nrows ): data.append( sheet.cell_value( row, 2 ) ) # Append data from excel to list2 Read this list and split each element into an array itself.Below doesn't work for me for i in data: for j in range( len( i ) ): split_data.append(list( data[j] ))3 Once splitting , print them into excel <No idea how to achieve this.I tried a lot from google about various python module but in vain. Lastly, i am seeking help here> 4 Future need : color the character 0 and O in excel sheet <didn't reached there so far but any help on this would be thankful> Thanks V RE: Need help | splitting list into list - Yoriz - Mar-12-2019 An example of what the variable data contains is required and also an example of how split_data should look afterwards split_data = [] data = 'unknown' for i in data: for j in range(len(i)): split_data.append(list(data[j])) print(split_data)
RE: Need help | splitting list into list - hshivaraj - Mar-12-2019 for i in data: for j in range( len( i ) ): split_data.append(list( data[j] ))I agree with Yoriz. I have no idea what is meant to do. For certain this wouldnt get you the results which list of list.specially i dont understand this part range(len(i)) . Why do that?Perhaps would really help you could provide us with the expected input and expected out. RE: Need help | splitting list into list - Vinci141 - Mar-13-2019 May be i have confused you folks because of some erroneous code ![]() Below is my requirement which i tried in excel , but i will accept any other approach. Input file type: .xlsx Input data : CODE NAME DETAILS Date RAM TEMPORARY VALUE1 3/14/2019 TOP TEMPORARY VALUE2 3/14/2019 Output file type: xlsx/html Here, i need letter 0 is colored RED in NAME column and DETAILS columns in output file.Similarly, letter O is colored blue. Thanks V |