Given the following list:
[['ORGANIZATION', 'EDUCATION', 'UniversityWon', 'FormMathematics'], ['PERSON', 'Sixth', 'Economics'], ['GPE', 'FrenchUK', 'London']]
I have the following for loop that prints them in the desired way:
for i in output:
print(i[0], '->', ', '.join(i[1:]))
Output of:
ORGANIZATION -> EDUCATION, UniversityWon, FormMathematics
PERSON -> Sixth, Economics
GPE -> FrenchUK, London
How can I save this output into a variable such that if I executed print(variable)
, the above-mentioned output would be printed?