> I was wondering how i could parse the contents of a file into an array. > the file would look something like this: > > gif:image/gif > html:text/html > jpg:image/jpeg
Try something like this: d = {} for line in open("input.txt").readlines(): ext, mime = line.strip().split(":") d[ext] = mime print d Craig -- http://mail.python.org/mailman/listinfo/python-list