I have dict in Python with keys of the following form:
mydict = {\'0\' : 10,
\'1\' : 23,
\'2.0\' : 321,
\'2.1\' : 3
For fun & usefulness (for googling ppl, mostly):
f = lambda i: [int(j) if re.match(r"[0-9]+", j) else j for j in re.findall(r"([0-9]+|[^0-9]+)", i)]
cmpg = lambda x, y: cmp(f(x), f(y))
use as sorted(list, cmp=cmpg).
Additionally, regexes might be pre-compiled (rarely necessary though, actually, with re module's caching).
And, it may be (easily) modified, for example, to include negative values (add -? to num regex, probably) and/or to use float values.
It might be not very efficient, but even with that it's quite useful.
And, uhm, it can be used as key= for sorted() too.