import csv
import io


def csv_to_dict(csv_str, separator=","):
    """ From a csv string, returns a list of dictionnaries
>>> csv_to_dict("a,b,c\\n1,2,3")
[{'a': '1', 'b': '2', 'c': '3'}]
>>> csv_to_dict("a,b,c\\n1,2,3\\n4,5,6")
[{'a': '1', 'b': '2', 'c': '3'}, {'a': '4', 'b': '5', 'c': '6'}]
>>> csv_to_dict("a;b;c\\n1;2;3", separator=";")
[{'a': '1', 'b': '2', 'c': '3'}]"""
    reader = csv.DictReader(io.StringIO(csv_str), delimiter=separator)

    # By default, DictReader returns OrderedDict => convert to dict:
    return list(map(dict, reader))