I think you did not the best job at describing the problem, it is not really clear why you have such files (i guess most people were assuming you have an existing array in python) containing an array definition as if it was written for a specific language with already set variables, instead of being a data feed with qouted strings etc.
Nonetheless, as long as you have just these simple values you can get this done within a few steps with the use of RegExp and JSON. The script below (see online demo at https://repl.it/repls/MarvelousMuddyQuadrants) shows you step by step how to clean the data and make it a JSON string, which then can be loaded with python’s json module.
import re
import json
# GC is done by Python, no need for file.close()
string = open('input.txt').read()
# Remove the array declaration start
string = re.sub(r"^array\(", '', string)
# Remove the array end declaration
string = re.sub(r"\)$", '', string)
# Remove all whitespaces and newlines
string = re.sub(r"\s*|\n*", '', string)
# Quote all strings and numbers
string = re.sub(r"([a-zA-Z0-9]+)", r'"\1"', string)
# Should be good enough now to be read with json.loads
mainlist = json.loads(string)
print(
"\n".join([" ".join(sublist) for sublist in mainlist])
)