I am writing a program that reads a 2D list from a .txt file, and I'm trying to loop through the list, and print each item in it. I've used a for loop to loop through each item in the list. The contents of the 2D list in the .txt file is:
['1', '10']
['Hello', 'World']
This is my code so far for opening the file, reading it, and looping through each item in the list:
file = open('Original_List.txt', 'r')
file_contents = file.read()
for i in file_contents.split():
print(i)
file.close()
The output that I get from this for loop is:
['1',
'10']
['Hello',
'World']
However, the output that I'm trying to get is:
1 10
Hello World
Is there any way that I can get this