参考回答:
def first_not_repeating_char(string):if not string:return -1resultDict = {}for k, s in enumerate(string):resultDict [s] = [resultDict [s][0] + 1,k] if resultDict .get(s) else [1,k]pos = len(string)ret = Nonefor x in resultDict :if resultDict [x][0] ==1 and resultDict [x][1] <pos:pos = resultDict [x][1]ret = (x,pos)return ret


