> Oltmans wrote: > >I've a string that looks something like > >---- > >lksjdfls <div id ='amazon_345343'> kdjff lsdfs </div> sdjfls <div id > >= "amazon_35343433">sdfsd</div><div id='amazon_8898'>welcome</div> > >---- > > > >>From above string I need the digits within the ID attribute. For > >example, required output from above string is > >- 35343433 > >- 345343 > >- 8898 > >
Your string is in /tmp/y in this example: $ grep -o [0-9]+ /tmp/y 345343 35343433 8898 Much simpler, isn't it? But that is not python. Regards Johann -- Johann Spies Telefoon: 021-808 4599 Informasietegnologie, Universiteit van Stellenbosch "And there were in the same country shepherds abiding in the field, keeping watch over their flock by night. And, lo, the angel of the Lord came upon them, and the glory of the Lord shone round about them: and they were sore afraid. And the angel said unto them, Fear not: for behold I bring you good tidings of great joy, which shall be to all people. For unto you is born this day in the city of David a Saviour, which is Christ the Lord." Luke 2:8-11 -- http://mail.python.org/mailman/listinfo/python-list