Importing string as an ordered dictionary
问题 I have a file with no extension with lines like this (ignore the spacing between the lines, but each line is a separate row): OrderedDict([('key1', u'value1'), ('key2', 'value2')]) OrderedDict([('key1', u'value1'), ('key2', 'value2')]) OrderedDict([('key1', u'value1'), ('key2', 'value2')]) when I import it to Python snap_fh = open("C:\Users\.......") for row in snap_fh: print(type(row)) rows are "strings" and I cannot parse it as an OrderedDictionary "OrderedDict([('key1', u'value1'), ('key2'