I need to parse text of text file into two categories:
University
Location(Example: Lahore, Peshawar, Jamshoro, Faisalabad)
but the text file contain following text:
"Imperial College of Business Studies, Lahore"
"Government College University Faisalabad"
"Imperial College of Business Studies Lahore"
"University of Peshawar, Peshawar"
"University of Sindh, Jamshoro"
"London School of Economics"
"Lahore School of Economics, Lahore"
I have written code that separate locations on the basis of 'comma'. The below code only work for first line of file and prints 'Lahore' after that it give following error 'list index out of range'.
file = open(path,'r')
content = file.read().split('\n')