I am given an ASCI file with this format:
my_dictionary = {
(1,0): "myvalue1",
(1,1): "myvalue2"
}
if the file was like this:
{
(1,0): "myvalue1",
(1,1): "myvalue2"
}
then this code would work:
file = open(myfile, "r")
contents = file.read()
mydic = ast.literal_eval(contents)
but in my situation there is a crash due to the first line of the ASCII file, is there a way to read also the variable name?