Jul-27-2019, 02:31 PM
(Jul-27-2019, 01:22 PM)SteampunkMaverick12 Wrote: how can I import this .csv into my dict especially when it has special characters?Read in with
utf-8
,once in inside it's a normal string(Unicode) as Python 3 has made big changes to Unicode.import csv with open('data.csv', encoding='utf-8') as csv_file: csv_reader = csv.reader(csv_file, delimiter=':') my_dict = dict([row for row in csv_reader]) print(my_dict)
Output:{'h': 'ᛄ', 'j': '☆', 'k': '☇'}
>>> my_dict['k']
'☇'