Hello Lad, > In a file there can be several dictionaries like this > {Key11: Value11 > Key12: Value12 > Key13: Value13, > ... > ... > Key1n:Value1n} > {Key21: Value21 > Key22: Value22 > Key23: Value23, > ... > ... > Key2n:Value2n} > {Key31: Value31 > Key32: Value32 > Key33: Value33, > ... > ... > Key3n:Value3n} > .... > .... > .... > {Keyn1: Valuen1 > Keyn2: Valuen2 > Keyn3: Value3, > ... > ... > Keynn:Valuenn} > > Each pair in a dictionary is separated by CRLF and in each dictionary > numbers of pairs can be different. > I need to read only the the first and the last dictionaries.What is a > best solution?
---- d.py --- #!/usr/bin/env python from sys import argv dicts = eval("[" + open(argv[1]).read().replace("}", "},") + "]") print dicts[0], dicts[-1] ---- d.py --- HTH. -- ------------------------------------------------------------------------ Miki Tebeka <[EMAIL PROTECTED]> http://tebeka.bizhat.com The only difference between children and adults is the price of the toys -- http://mail.python.org/mailman/listinfo/python-list