This will work:
import itertools as it
mylist = [['a1'],['a2'],['c1'],['b1']]
keyfunc = lambda x: x[0][0]
mylist = sorted(mylist, key=keyfunc)
a, b, c = [list(g) for k, g in it.groupby(mylist, keyfunc)]
The line in which it is used sorted()is necessary only if the elements in are mylistno longer sorted by the character at the beginning of the line.
EDIT:
, ( ) ( Python 2.7+) :
result_dict = {k: list(g) for k, g in it.groupby(mylist, keyfunc)}
:
result_dict['a']
> [['a1'],['a2']]
result_dict['b']
> [['b1']]
result_dict['c']
> [['c1']]