с использованием Python, я импортирую данные из текстового файла с примерами данных ниже:
ABB : {'Code': 'adr', 'Volume': 2238117, 'Sector': 'Industrials', 'Market_Cap': 'No Data', 'Industry': 'Industrial Products', 'List_Date': '2001-04-06'},
ABEV : {'Code': 'adr', 'Volume': 19348239, 'Sector': 'Consumer Defensive', 'Market_Cap': 'No Data', 'Industry': 'Beverages - Alcoholic', 'List_Date': '2013-11-11'},
Я импортирую его в словарь со следующим фрагментом:
with open('list_all.csv', mode='r') as infile:
reader = csv.reader(infile)
result = {}
for row in reader:
key = row[0]
result[key] = row[1:]
он импортируется как словарь, но проблема в том, что КЛЮЧ не в "", например "ABB"
или "ABEV"
. как только я импортирую его, мой dic выглядит следующим образом:
"ABB : {'Code': 'adr'": [" 'Volume': 2238117",
" 'Sector': 'Industrials'",
" 'Market_Cap': 'No Data'",
" 'Industry': 'Industrial Products'",
" 'List_Date': '2001-04-06'}",
''],
Как лучше всего решить эту проблему