I am going to take a slightly different apporch now. I want to mainly concentrate on the spliting the data up using the commas ,
current data
ID |FIRSTNAME| SECONDNAME |Study |
------------------------------------------
12400 JOHN MAN IT
------------------------------------------
12500 NICE JOHN LAW
-------------------------------------------
12600 PATRICK MAN CS
------------------------------------------
Code:
f = open("List", "r") #open and read file
returnline = [] #empty list
for line in f.readlines(): #loop for making each line into a large string
Now I would think it would be to split the data up with the , so in the program i am going to have ' ' a white space and i want to tell the program to fill that white space with , so the data is splited by , since i am using list i know i gota concate the string with the list called returnline using append
i was thinking using this code
Code:
returnlines.append(line.replace('\n', '').split(','))
#by asking the line string to be replaced the \n with nothing ''
the new data should look like something like dis
------------------------------------------
12400, JOHN, MAN, IT,
------------------------------------------
12500, NICE, JOHN, LAW,
-------------------------------------------
12600, PATRICK, MAN, CS,
------------------------------------------
but i am stuck now dont know wat to do