In addition to the comments above, you might want to consider the popular Pandas library, which makes working with tabular data much easier. You can read your CSV file into a Pandas DataFrame in one line, df = pandas.read_csv(database_filename, names=['quantity', 'fee', 'powers'], index_col=0), and it will automatically convert all the data types for you. You can then output it to a Python dict in the specified format with df.to_dict(orient='index'), to a JSON file with df.to_json(json_filename, orient='index') or to your original CSV with df.to_csv(database_filename). You can sort your df with df.sort_index()
However, there is one potential problem with either this approach or the previous suggested csv based one—you have a variable number of powers fields, which it looks like you intend to read as a nested list. Bringing in a bit of domain-specific knowledge, it looks like this corresponds to a Pokemon’s “Type”, which per Bulbapedia, a Pokemon can only have one or two types. Thus, the simplest way to handle this is to just declare two columns, type1 and type2, and Pandas (or csv) will fill in the second one with a full value if it is not present. Of course, that doesn’t get you a list in your output data structure, but is a lot simpler to work with; once you get your dict, you can concatenate them into a list, e.g. something like data_dict['types'] = [data_dict.pop(f'type{n}') for n in [1, 2] if f'type{n}' in data_dict].