Answer
You may have already solved this problem. However here is my attempt. We can use basic list and string functionality.
Your data seem to be a mix of strings in some list entries and nested lists in other, so play around with this to get to what you need.
data = [['Department of Computer Languages and Computing Sciences, University of Málaga, Málaga, Spain'],
['Poste Italiane - Information Technology, Research and Development - R and D Center, Piazza Matteotti 3, 80133 Naples, Italy'],
['Department of Computer and Information Science, University of Macau, Macau',
'Mathematics and Scientific Computing, National Physical Laboratory, Teddington, London TW11 0LW, United Kingdom',
'Department of Computer Science and Engineering, C. V. Raman College of Engineering, Bhubaneswar 752054, India']]
new_list = []
new_list2 = []
for entry2 in data:
string = str(entry2)
new_string = string.replace('[\'', '').replace('\']','').replace('\,\s','')
new_entry = new_string.split(',')
new_list2.append(new_entry)
new_list.append(new_list2)
print(new_list)
@michaelmorar
Split by coma the content of python list embedded in list
I need help in splitting by coma a content of a list that is inside a list, basically I have such data
[['Department of Computer Languages and Computing Sciences, University of Málaga, Málaga, Spain'],
['Poste Italiane - Information Technology, Research and Development - R and D Center, Piazza Matteotti 3, 80133 Naples, Italy'],
['Department of Computer and Information Science, University of Macau, Macau',
'Mathematics and Scientific Computing, National Physical Laboratory, Teddington, London TW11 0LW, United Kingdom',
'Department of Computer Science and Engineering, C. V. Raman College of Engineering, Bhubaneswar 752054, India']]
And I want this outcome
[[['Department of Computer Languages and Computing Sciences',
'University of Málaga',
'Málaga',
'Spain']],
[['Poste Italiane - Information Technology',
'Research and Development - R and D Center',
'Piazza Matteotti 3',
'80133 Naples',
'Italy']],
[['Department of Computer and Information Science',
'University of Macau',
'Macau'],
['Mathematics and Scientific Computing',
'National Physical Laboratory',
'Teddington',
'London TW11 0LW',
'United Kingdom'],
['Department of Computer Science and Engineering',
'C. V. Raman College of Engineering',
'Bhubaneswar 752054',
'India']]]
@